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

simulation with smach

asked 2018-08-06 04:26:03 -0500

Krebsileinchen gravatar image

updated 2018-08-07 01:42:36 -0500

I am using smach to define missions which are executed by a robot. I am both using states specifically designed for the smach plan and SimpleActionStates to use predefined actionlib actions. Currently I am want to simulate my smach plan without actually having connection to the robot. The problem is that in the simulation mode some nodes and some action servers which are called as SimpleActionStates are not running. So the simulation works perfectly for the visualisation of the robot movements but when trying to use the SimpleActionState e.g. for opening the gripper it fails or rather gets trapped in waiting for the action server. Is it possible to automatically skip these SimpleActionStates under certain conditions? (Set them succeeded without even trying to call the action server or something like this.) These states are not needed for the simulation but they disrupt the simulation of the usual mission. My only idea so far to bypass this issue is to add an userdata input to every non SimpleActionState who sets the outcome to "simulation" if needed. Than for the critical parts the transition for the simulation outcome could be defined to skip all SimpleActionStates and continue with the next state which is useable for the simulation. However this doesn't seem like an elegant solution and I am wondering if there are any other options. Thank you in advance for all tipps and suggestions!!

edit retag flag offensive close merge delete

Comments

1

Would creating some 'fake' actionservers not be possible?

We've done this in just about all our systems: whenever there is no need for the real hw to be present, create a mock implementation that returns the appropriate data.

That's not even new/inventive: just applying an existing pattern.

gvdhoorn gravatar image gvdhoorn  ( 2018-08-07 10:42:26 -0500 )edit

For my own action servers that's easily done. However, I am struggling to do this for action servers defined in other packages. When trying to define action servers locally with the same name I get the error "node name cannot contain a namespace".

Krebsileinchen gravatar image Krebsileinchen  ( 2018-08-09 04:29:14 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-08-07 09:03:19 -0500

My only idea so far to bypass this issue is to add an userdata input to every non SimpleActionState who sets the outcome to "simulation" if needed. Than for the critical parts the transition for the simulation outcome could be defined to skip all SimpleActionStates and continue with the next state which is useable for the simulation.

This sounds like you are on the right track.

Two possible suggestions/improvements:

  • Consider using a ROS Parameter - e.g. /simulation. This is a bit more elegant than using a userdata input.
  • Even better, you could subclass the SimpleActionState to check if the /simulation (or ~simulation) ROS Param is true, and if so, to return the expected output.

ROS Parameter Server
ROS Name Resolution


FYI, I'd suggest looking at FlexBE. It's a graphical state machine editor/simulator built on top of ROS. It's still being developed and may be good for your needs.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-08-06 04:26:03 -0500

Seen: 237 times

Last updated: Aug 07 '18