Other Core API Templates

MsgPublisher

The MsgPublisher template provides a helper class for The PublishMsgState Template and is specified as follows:

Template: MsgPublisher
Description: SMACH template that provides a MsgPublisher helper class for PublishMsgState.
Language: Python
Framework: SMACH
Type: None

MsgPublisherObserver

The MsgPublisherObserver template provides a helper class for The PublishObserverMsgState Template and is specified as follows:

Template: MsgPublisherObserver
Description: SMACH template that provides a MsgPublisherObserver helper class for PublishMsgState.
Language: Python
Framework: SMACH
Type: None

ParseJointTrajectoryPoint

The ParseJointTrajectoryPoint template provides a helper function for parsing trajectory_msgs/JointTrajectoryPoint types and is specified as follows:

Template: ParseJointTrajectoryPoint
Description: SMACH template that provides a ParseJointTrajectoryPoint helper function for, e.g. PublishMsgState. The function takes an input argument that can be specified as either a trajectory_msgs.msg.JointTrajectoryPoint type, a sensor_msgs.msg.JointState type or a [n] list type. and returns a trajectory_msgs.msg.JointTrajectoryPoint type.
Language: Python
Framework: SMACH
Type: None

ParsePointCloud

The ParsePointCloud template provides a helper function for parsing sensor_msgs/PointCloud types and is specified as follows:

Template: ParsePointCloud
Description: SMACH template that provides a ParsePointCloud helper function for, e.g. PublishMsgState. The function takes an input argument that can be specified as either a sensor_msgs.msg.PointCloud or sensor_msgs.msg.PointCloud2 type, and returns a sensor_msgs.msg.PointCloud type.
Language: Python
Framework: SMACH
Type: None

ParsePointCloud2

The ParsePointCloud2 template provides a helper function for parsing sensor_msgs/PointCloud2 types and is specified as follows:

Template: ParsePointCloud2
Description: SMACH template that provides a ParsePointCloud helper function for, e.g. PublishMsgState. The function takes an input argument that can be specified as either a sensor_msgs.msg.PointCloud or sensor_msgs.msg.PointCloud2 type, and returns a sensor_msgs.msg.PointCloud2 type.
Language: Python
Framework: SMACH
Type: None

ParsePointStamped

The ParsePointStamped template provides a helper function for parsing geometry_msgs/PointStamped types and is specified as follows:

Template: ParsePointStamped
Description: SMACH template that provides a ParsePointStamped helper function for, e.g. PublishMsgState. The function takes an input argument that can be specified as either a geometry_msgs.msg.Point type, a geometry_msgs.msg.PointStamped type or as a [3] list, and returns a geometry_msgs.msg.Point type.
Language: Python
Framework: SMACH
Type: None

ParsePose

The ParsePose template provides a helper function for parsing geometry_msgs/Pose types and is specified as follows:

Template: ParsePose
Description: SMACH template that provides a ParsePose helper function for, e.g. PublishMsgState. The function takes an input argument that can be specified as either a geometry_msgs.msg.Pose type, a geometry_msgs.msg.PoseStamped type, or as a [[3],[4]] list, and returns a geometry_msgs.msg.Pose type.
Language: Python
Framework: SMACH
Type: None

ParsePoseArray

The ParsePoseArray template provides a helper function for parsing geometry_msgs/PoseArray types and is specified as follows:

Template: ParsePoseArray
Description: SMACH template that provides a ParsePoseArray helper function for, e.g. PublishMsgState. The function takes an input argument that can be specified as a geometry_msgs.msg.PoseArray type or as a list of geometry_msgs.msg.Pose types, geometry_msgs.msg.PoseStamped types or [[3],[4]] lists, and returns a geometry_msgs.msg.PoseArray type.
Language: Python
Framework: SMACH
Type: None

ParsePoseStamped

The ParsePoseStamped template provides a helper function for parsing geometry_msgs/PoseStamped types and is specified as follows:

Template: ParsePoseStamped
Description: SMACH template that provides a ParsePoseStamped helper function for, e.g. PublishMsgState. The function takes an input argument that can be specified as either a geometry_msgs.msg.Pose type, a geometry_msgs.msg.PoseStamped type, or a [[3],[4]] list, and returns a geometry_msgs.msg.PoseStamped type.
Language: Python
Framework: SMACH
Type: None

ParseTransformStamped

The ParseTransformStamped provides a helper function for parsing geometry_msgs/TransformStamped types and is specified as follows:

Template: TransformStamped
Description: SMACH template that provides a TransformStamped helper function for, e.g. PublishMsgState. The function takes an input argument that can be specified as either a geometry_msgs.msg.Transform type, a geometry_msgs.msg.TransformStamped type or as a [[3],[4]] list, and returns a geometry_msgs.msg.TransformStamped type.
Language: Python
Framework: SMACH
Type: None

ROSBagAPIThreadRecorder

The ROSBagAPIThreadRecorder provides a helper class for the RecordROSBagState template that allows for ROS bags to be recorded using the ROS bag Python application programming interface and is specified as follows:

Template: ROSBagAPIThreadRecorder
Description: SMACH template that provides a ROSBagAPIThreadRecorder helper class for RecordROSBagState. It uses the rosbag API (application programming interface) as well as the threading library in order to manage multiple recording threads. NOTE: this means that this recorder may have issues with the Python GIL (global interpreter lock) when other threads (e.g. MoveIt! commands) block execution.
Based in part on code from: https://github.com/francisc0garcia/sensor_board/blob/master/src/classes/bags/recorder.py

Language: Python
Framework: SMACH
Type: None

ROSBagCLIProcessRecorder

The ROSBagCLIProcessRecorder provides a helper class for the RecordROSBagState template that allows for ROS bags to be recorded using the ROS bag command line interface and is specified as follows:

Template: ROSBagCLIProcessRecorder
Description: SMACH template that provides a ROSBagCLIProcessRecorder helper class for RecordROSBagState. It uses subprocess calls to the rosbag CLI (command-line interface) recording tool in order to circumvent threading and Python GIL (global interpreter lock) issues.
See: https://answers.ros.org/question/10714/start-and-stop-rosbag-within-a-python-script/

Language: Python
Framework: SMACH
Type: None

WaitForMsgState

The WaitForMsgState template provides a helper class for The ReadTopicState Template and is specified as follows:

Template: WaitForMsgState
Description: SMACH template that provides a WaitForMsgState helper class for ReadTopicState.
The class acts as a generic message listener with blocking, timeout, latch and flexible usage.
It is meant to be extended with a case specific class that initializes this one appropriately and contains the msg_cb (or overrides execute if really needed).
Its waitForMsg method implements the core functionality: waiting for the message, returning the message itself or None on timeout.
Its execute method wraps the waitForMsg and returns succeeded or aborted, depending on the returned message being existent or None. Additionally, in the successful case, the msg_cb, if given, will be called with the message and the userdata, so that a self defined method can convert message data to smach userdata. Those userdata fields have to be passed via 'output_keys'.
Based on the original code described here:
    http://wiki.ros.org/executive_smach/AdditionalStateTypes
    https://github.com/felix-kolbe/uashh-rvl-ros-pkg/blob/master/uashh_smach/src/uashh_smach/util.py

Language: Python
Framework: SMACH
Type: None
Extends:
    State
Variables:
    topic: The name of the topic from which the data should be read.
        Type: str

    msg_type: The ROS message type of the topic.
        Type: str

    msg_cb (optional): If the state outcome should depend on the message content, the msg_cb can dictate the outcome: If the state outcome should depend on the message content, the msg_cb can dictate the outcome: If msg_cb returns True, execute() will return "succeeded". If msg_cb returns False, execute() will return "aborted". If msg_cb has no return statement, execute() will act as described above.

        Type: str

    latch (optional): If True waitForMsg will return the last received message, so one message might be returned indefinite times.
        Type: bool

    timeout (optional): Seconds to wait for a message, defaults to None, disabling timeout.
        Type: int

    output_keys (optional): Userdata keys that the message callback needs to write to.
        Type: list of str

Outcomes:
    succeeded
    aborted