Skip to content

Commit

Permalink
cleaning up example
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Henkel <[email protected]>
  • Loading branch information
ct2034 committed Dec 16, 2024
1 parent 4d22d75 commit 2953e42
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
<Action ID="UpdateGoalAndCurrentPosition" goal_x="{goal_x}" goal_y="{goal_y}" curr_x="{curr_x}" curr_y="{curr_y}" move_out="{move}" move_in="{move}" />
<Fallback name="move_to_goal">
<!--
Movement enum in the world.
0: right,
1: left,
2: up,
3: down
move: 0 - right
1 - left
2 - up
3 - down
4 - stop
-->

<Sequence name="TryR">
<Condition ID="ShallMove" direction="0" name="check_right" goal_x="{goal_x}" goal_y="{goal_y}" curr_x="{curr_x}" curr_y="{curr_y}" />
<Action ID="Move" direction="0" name="move_right" move="{move}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,22 @@
model_src=""
xmlns="http://www.w3.org/2005/07/scxml">

<!--
Movement enum in the world.
0: right,
1: left,
2: up,
3: down
-->
<bt_declare_port_in key="direction" type="int32" />
<!-- <bt_declare_port_in key="cmd_topic" type="string" /> -->
<bt_declare_port_out key="move" type="int32" />
<!--
move: 0 - right
1 - left
2 - up
3 - down
4 - stop
-->

<datamodel>
<data id="direction" expr="0" type="int32" />
</datamodel>

<!-- <ros_topic_publisher name="move_pub" type="std_msgs/Int16">
<topic>
<bt_get_input key="cmd_topic" />
</topic>
</ros_topic_publisher> -->

<state id="running">
<bt_tick target="running">
<!-- <ros_topic_publish name="move_pub">
<field name="data">
<expr>
<bt_get_input key="direction" />
</expr>
</field>
</ros_topic_publish> -->
<assign location="direction">
<expr>
<bt_get_input key="direction" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@
3 - down
4 - stop
-->
<!-- <bt_declare_port_in key="goal_topic" type="string" />
<bt_declare_port_in key="curr_topic" type="string" /> -->

<ros_topic_publisher name="at_goal" topic="at_goal" type="std_msgs/Bool" />

<datamodel>
<!-- <data id="is_goal_init" expr="false" type="bool" /> -->
<data id="is_pose_init" expr="false" type="bool" />
<data id="goal_x" expr="99" type="int32" />
<data id="goal_y" expr="99" type="int32" />
Expand All @@ -36,33 +33,6 @@
<data id="first_tick" expr="true" type="bool" />
</datamodel>

<!-- <state id="running">
New robot goal
<ros_topic_callback name="goal_sub" target="running">
<assign location="goal_x" expr="_msg.x" />
<assign location="goal_y" expr="_msg.y" />
<assign location="is_goal_init" expr="true" />
</ros_topic_callback>
New robot pose
<ros_topic_callback name="curr_sub" target="running">
<assign location="curr_x" expr="_msg.x" />
<assign location="curr_y" expr="_msg.y" />
<assign location="is_pose_init" expr="true" />
</ros_topic_callback>
Leaf node tick
<bt_tick target="running">
<if cond="is_goal_init &amp;&amp; is_pose_init">
<bt_set_output key="goal_x" expr="goal_x" />
<bt_set_output key="goal_y" expr="goal_y" />
<bt_set_output key="curr_x" expr="curr_x" />
<bt_set_output key="curr_y" expr="curr_y" />
<bt_return_status status="SUCCESS" />
<else />
<bt_return_status status="FAILURE" />
</if>
</bt_tick>
</state> -->

<state id="init">
<onentry>
<bt_set_output key="move_out" expr="4" />
Expand Down Expand Up @@ -105,10 +75,6 @@
<field name="data" expr="true" />
</ros_topic_publish>
</if>
<!-- <ros_topic_publish name="pose">
<field name="x" expr="pose_x" />
<field name="y" expr="pose_y" />
</ros_topic_publish> -->
<bt_return_status status="SUCCESS" />
</transition>
</state>
Expand Down

0 comments on commit 2953e42

Please sign in to comment.