pycram.external_interfaces.knowrob#

Attributes#

Functions#

init_object_state()

Publishes the initial state of the objects in the world to Knowrob. Because of the lru_cache decorator, this function

pose_to_json(→ Dict[str, Union[float, str]])

Converts a PoseStamped object to a JSON-like dictionary.

object_to_json(→ Dict[str, Dict[str, str]])

Converts an object or object designator to a JSON-like dictionary containing its type.

grasp_description_to_json(→ Dict[str, Union[float, str]])

Converts a GraspDescription object to a JSON-like dictionary.

kwargs_to_json(→ dict)

Converts the keyword arguments of a DesignatorNode to a JSON-like dictionary, calls the appropriate conversion function

designator_to_json(→ str)

Converts a DesignatorNode to a JSON-like string representation uses the kwargs of the node for conversion.

get_current_ros_time(→ pycram.ros.Time)

Returns the ROS time as a ROSTime object.

execution_start_callback(node)

Callback function that is called when the execution of a designator starts. It publishes a message to Knowrob

execution_finished_callback(node)

Callback function that is called when the execution of a designator finishes. It publishes a message to Knowrob

resolution_start_callback(node)

Callback function that is called when the resolution of a designator starts. It publishes a message to Knowrob

resolution_finished_callback(node)

Callback function that is called when the resolution of a designator finishes. It publishes a message to Knowrob

Module Contents#

pycram.external_interfaces.knowrob.desig_execution_start#
pycram.external_interfaces.knowrob.desig_execution_finished#
pycram.external_interfaces.knowrob.desig_resolution_start#
pycram.external_interfaces.knowrob.desig_resolution_finished#
pycram.external_interfaces.knowrob.desig_init#
pycram.external_interfaces.knowrob.object_desig#
pycram.external_interfaces.knowrob.init_object_state()#

Publishes the initial state of the objects in the world to Knowrob. Because of the lru_cache decorator, this function will only be called once, and the result will be cached for future calls.

pycram.external_interfaces.knowrob.pose_to_json(pose: PoseStamped) Dict[str, float | str]#

Converts a PoseStamped object to a JSON-like dictionary.

:return : A dictionary representation of the pose.

pycram.external_interfaces.knowrob.object_to_json(obj: knowrob_designator.msg.ObjectDesignator | Object) Dict[str, Dict[str, str]]#

Converts an object or object designator to a JSON-like dictionary containing its type.

Parameters:

obj – The object or object designator to convert.

Returns:

A dictionary representation of the object.

pycram.external_interfaces.knowrob.grasp_description_to_json(grasp: GraspDescription) Dict[str, float | str]#

Converts a GraspDescription object to a JSON-like dictionary.

Parameters:

grasp – The GraspDescription object to convert.

Returns:

A dictionary representation of the grasp.

pycram.external_interfaces.knowrob.kwargs_to_json(kwargs: Dict) dict#

Converts the keyword arguments of a DesignatorNode to a JSON-like dictionary, calls the appropriate conversion function for each value based on its type.

Parameters:

kwargs – The keyword arguments to convert.

Returns:

A dictionary representation of the keyword arguments.

pycram.external_interfaces.knowrob.designator_to_json(node: pycram.plan.DesignatorNode) str#

Converts a DesignatorNode to a JSON-like string representation uses the kwargs of the node for conversion.

Parameters:

node – The DesignatorNode to convert.

Returns:

A JSON-like string representation of the DesignatorNode.

pycram.external_interfaces.knowrob.get_current_ros_time() pycram.ros.Time#

Returns the ROS time as a ROSTime object.

Returns:

The current ROS time.

pycram.external_interfaces.knowrob.execution_start_callback(node: pycram.plan.PlanNode)#

Callback function that is called when the execution of a designator starts. It publishes a message to Knowrob containing the designator that is executed.

pycram.external_interfaces.knowrob.execution_finished_callback(node: pycram.plan.PlanNode)#

Callback function that is called when the execution of a designator finishes. It publishes a message to Knowrob containing the designator that has just finished executing.

pycram.external_interfaces.knowrob.resolution_start_callback(node: pycram.plan.PlanNode)#

Callback function that is called when the resolution of a designator starts. It publishes a message to Knowrob containing the designator that is being resolved. It also sends the initial state of the objects in the world.

pycram.external_interfaces.knowrob.resolution_finished_callback(node: pycram.plan.PlanNode)#

Callback function that is called when the resolution of a designator finishes. It publishes a message to Knowrob containing the designator that has just finished resolving.