ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

I think this is not covered in one of the tutorials yet, but I am working on a new set of tutorials where this will be included.

You can use any ROS message or Python object as initial userdata by calling the object constructor in the value field of the "State Machine Userdata" panel of the Behavior Dashboard, e.g., PoseStamped().

In addition, you need to make sure that the class is imported. This is done directly in the code. Click on "Edit Code" to open the source code and enter, e.g., from geometry_msgs.msg import PoseStamped, in the "manual import" section indicated at the top of the file.

There is also a "manual create" section further below which I would recommend to use to construct more complex objects and set values.

As a third choice, you can define a function in the "manual function" section, e.g.,

def pose(self, x, y):
    p = PoseStamped()
    p.pose.position.x = x
    p.pose.position.y = y
    return p

and then use something like pose(1,2) instead of PoseStamped() in the Dashboard as described above.