Ask Your Question

PoseStamped as flexbe app userdata

asked 2017-05-19 05:04:26 -0500

Alireza gravatar image

I am very new to the flexbe app and now I want to use the 'PublishPoseState' in my behavior, but I don't know how can I define a state machine user data with PoseStamped Type, Is there any example or tutorial for that (obviously defining a string message is very simple)?

edit retag flag offensive close merge delete


I'll be using FlexBE heavily next week so if nobody is able to help before then I'll let you know what I come across.

ufr3c_tjc gravatar image ufr3c_tjc  ( 2017-05-19 23:08:12 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2017-05-20 04:34:24 -0500

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.

edit flag offensive delete link more


I already solved it, but thanks for your complete descriptions, I'm really looking forward to more tutorials. ;-)

Alireza gravatar image Alireza  ( 2017-05-22 06:54:01 -0500 )edit

answered 2018-03-27 05:50:04 -0500

StefanB gravatar image

I was stuck on this for a while, since I couldn't find an "Edit Code" button, and I was confused about which source code I had to edit. I found out that the source code Phillip Schillinger talks about is the .py code of the behaviour you are using the class in. So in your own Flexbe package go to behaviours and find the .py code of the behaviour that uses the class.

Also, in my case, my class had 6 inputs, I needed to define these in the defaut userdata as well. So (again, in my case) I had to enter the following in as default userdata: Buoy(0, 0, 'string', 0, 0, 'string'), where 'Buoy' is the name of my class. Just using Buoy() does not work.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2017-05-19 05:04:26 -0500

Seen: 230 times

Last updated: Mar 27 '18