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

SMACH sequences from configuration file

asked 2017-05-03 06:24:37 -0500

knxa gravatar image

updated 2017-05-03 06:27:16 -0500

I am implementing my first ROS solution. I need to control some motors and sensors in various sequences. Some stuff must execute in parallel and some only if certain conditions are present.

It is my impression that the most standard way of doing this in ROS is:

  • use ROS actions, e.g. to run a motor
  • use SMACH for tasks, e.g. to create a sequence of ROS actions: move motor X, then move motor Y, then move both XY in parallel.

I want to be able to create such SMACH tasks from one or more configuration files. For example, I want to define an initialization task which moves motors to certain start positions, in a certain order and with a certain speed. The configuration should be able to create named tasks, and then combine such tasks into new, higher level tasks. The definition of a task should allow specifying parameters that affects the actions, e.g. motor speed.

Does a system like that exist in the ROS eco system or do you know of concepts that I can adapt to my need? Any input to the above plans are welcome, thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-07-31 08:57:52 -0500

knxa gravatar image

I decided to use an xml configuration file to build SMACH trees.
Here is an example:

<tasks>
  <task label="movetest">
    <sequence loops="10">
      <subtask label="gohome" />
      <concurrent>
        <action node="AxisX1" cmd="Goto" pos="0.2"/>
        <action node="AxisX2" cmd="Goto" pos="-0.3"/>
      </concurrent>
      <sequence>
        <action node="AxisX1" cmd="Goto" pos="0.5"/>
        <delay seconds="1.2"/>
        <action node="AxisX2" cmd="Goto" pos="-0.1"/>
      </sequence>
    </sequence>
  </task>
  <task label="gohome">
    <concurrent>
      <action node="AxisX1" cmd="Goto" pos="0.0"/>
      <action node="AxisX2" cmd="Goto" pos="0.0"/>
    </concurrent>
  </task>
</tasks>

Comments:

  • the "gohome" and "movetest" tasks becomes toplevel states in a SMACH state machine. These tasks can be executed by referring to their name,
  • a task may reference another task (subtask)
  • action tags translate to a SimpleActionState with conventions on what action server to call based on attributes "node" and "cmd"
  • sequence and concurrent tags translate into SMACH sequence and concurrence containers
edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2017-05-03 06:24:37 -0500

Seen: 268 times

Last updated: Jul 31 '17