Skip to content

Commit

Permalink
Use the name of the safe teleop input topics with args
Browse files Browse the repository at this point in the history
  • Loading branch information
708yamaguchi authored and knorth55 committed Jul 16, 2020
1 parent aaf2ac2 commit 41634d5
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 28 deletions.
20 changes: 11 additions & 9 deletions jsk_fetch_robot/jsk_fetch_startup/launch/fetch_teleop.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<launch>
<machine name="localhost" address="localhost" />
<!-- mainly copied from $(find fetch_bringup)/launch/include/teleop.launch.xml -->
<arg name="enable_auto_dock" default="true" />
<arg name="joy_device" default="/dev/ps3joy"/>
Expand Down Expand Up @@ -31,7 +30,17 @@
</node>

<!-- Mux cmd_vel topics -->
<include file="$(find jsk_robot_startup)/launch/safe_teleop.launch" />
<include file="$(find jsk_robot_startup)/launch/safe_teleop.launch" >
<arg name="odom_topic" value="/odom_combined"/>
<arg name="navigation_topic" value="/cmd_vel"/>
</include>
<!-- Relay topic names according to system diagram -->
<node name="relay_odom"
pkg="topic_tools" type="relay"
args="/odom /odom_teleop" />
<node name="relay_navigation_cmd_vel"
pkg="topic_tools" type="relay"
args="/cmd_vel /navigation/cmd_vel" />
<group ns="safe_teleop_base">
<rosparam file="$(find fetch_navigation)/config/costmap_common.yaml" command="load" ns="local_costmap" />
<rosparam file="$(find fetch_navigation)/config/fetch/costmap_common.yaml" command="load" ns="local_costmap" />
Expand Down Expand Up @@ -64,13 +73,6 @@
footprint_padding: 0.05
</rosparam>
</group>
<!-- Relay topic names for safe_teleop.launch -->
<node name="relay_odom"
pkg="topic_tools" type="relay"
args="/odom /odom_teleop" />
<node name="relay_navigation_cmd_vel"
pkg="topic_tools" type="relay"
args="/cmd_vel /navigation/cmd_vel" />

<!-- Do not publish /base_controller/command if fetch is docking -->
<node pkg="jsk_fetch_startup" name="warning" type="warning.py" respawn="true" />
Expand Down
16 changes: 9 additions & 7 deletions jsk_pr2_robot/jsk_pr2_startup/jsk_pr2_move_base/safe_teleop.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@
<!-- Mux cmd_vel topics -->
<include file="$(find jsk_robot_startup)/launch/safe_teleop.launch">
<arg name="machine" value="c2" />
<arg name="odom_topic" value="/base_odometry/odom" />
<arg name="teleop_topic" value="/teleop/joy_vel" />
</include>
<!-- Relay topic names according to system diagram -->
<node name="relay_odom"
pkg="topic_tools" type="relay"
args="/base_odometry/odom /odom_teleop" />
<node name="relay_teleop_cmd_vel"
pkg="topic_tools" type="relay"
args="/teleop/joy_vel /teleop/cmd_vel/unsafe" />
<group ns="safe_teleop_base">
<rosparam file="$(find jsk_pr2_startup)/jsk_pr2_move_base/costmap_common_params.yaml" command="load" ns="local_costmap" />
<rosparam file="$(find jsk_pr2_startup)/jsk_pr2_move_base/local_costmap_params.yaml" command="load" ns="local_costmap" />
Expand All @@ -33,13 +42,6 @@
<rosparam file="$(find jsk_pr2_startup)/jsk_pr2_move_base/local_costmap_params.yaml" command="load" ns="local_costmap" />
<rosparam file="$(find jsk_pr2_startup)/jsk_pr2_move_base/safe_teleop_pr2_params.yaml" command="load" ns="local_costmap"/>
</group>
<!-- Relay topic names for safe_teleop.launch -->
<node name="relay_odom"
pkg="topic_tools" type="relay"
args="/base_odometry/odom /odom_teleop" />
<node name="relay_teleop_cmd_vel"
pkg="topic_tools" type="relay"
args="/teleop/joy_vel /teleop/cmd_vel/unsafe" />

<!-- check cable and filter baser_controller/command -->
<node pkg="roseus" type="roseus" name="cable_warning" respawn="true"
Expand Down
30 changes: 18 additions & 12 deletions jsk_robot_common/jsk_robot_startup/launch/safe_teleop.launch
Original file line number Diff line number Diff line change
@@ -1,47 +1,53 @@
<launch>
<machine name="localhost" address="localhost" />

<arg name="machine" default="localhost" />
<arg name="odom_topic" default="/odom_teleop" />
<arg name="teleop_topic" default="/teleop/cmd_vel/unsafe" />
<arg name="navigation_topic" default="/navigation/cmd_vel" />
<arg name="input_topic" default="/input_vel/unsafe" />

<!-- /teleop/cmd_vel/unsafe -> /teleop/cmd_vel/safe -->
<!-- $(arg teleop_topic) -> /teleop/cmd_vel/safe -->
<node name="safe_teleop_base" pkg="safe_teleop_base" type="safe_teleop_base"
machine="$(arg machine)" >
<remap from="/odom" to="/odom_teleop"/>
<remap from="base_velocity" to="/teleop/cmd_vel/unsafe" />
<remap from="/odom" to="$(arg odom_topic)"/>
<remap from="base_velocity" to="$(arg teleop_topic)" />
<remap from="~safe_vel" to="/teleop/cmd_vel/safe" />
</node>

<!-- unsafe mux: (/teleop/cmd_vel/unsafe & /teleop/cmd_vel/safe) -> /teleop/cmd_vel -->
<!-- unsafe mux: ($(arg teleop_topic) & /teleop/cmd_vel/safe) -> /teleop/cmd_vel -->
<node name="unsafe_vel_mux" pkg="topic_tools" type="mux"
respawn="true" machine="$(arg machine)"
args="/teleop/cmd_vel /teleop/cmd_vel/safe /teleop/cmd_vel/unsafe">
args="/teleop/cmd_vel /teleop/cmd_vel/safe $(arg teleop_topic)">
<remap from="mux" to="unsafe_vel_mux" />
</node>
<!-- unsafe mux selector with PS3 R2 button -->
<node name="unsafe_vel_selector" pkg="jsk_robot_startup" type="mux_selector.py"
respawn="true" machine="$(arg machine)"
args="/joy 'm.buttons[9]==1' /teleop/cmd_vel/unsafe /joy 'm.buttons[9]==0' /teleop/cmd_vel/safe">
args="/joy 'm.buttons[9]==1' $(arg teleop_topic) /joy 'm.buttons[9]==0' /teleop/cmd_vel/safe">
<remap from="mux" to="unsafe_vel_mux" />
<param name="default_select" value="/teleop/cmd_vel/safe" />
</node>

<!-- /input_vel/unsafe -> /input_vel/safe -->
<!-- $(arg input_topic) -> /input_vel/safe -->
<node name="safe_input_vel" pkg="safe_teleop_base" type="safe_teleop_base"
machine="$(arg machine)" >
<remap from="/odom" to="/odom_teleop"/>
<remap from="base_velocity" to="/input_vel/unsafe" />
<remap from="/odom" to="$(arg odom_topic)"/>
<remap from="base_velocity" to="$(arg input_topic)" />
<remap from="~safe_vel" to="/input_vel/safe" />
</node>

<!-- vel type mux: (/teleop/cmd_vel & /navigation/cmd_vel & /input_vel/safe) -> /base_controller/command_unchecked -->
<!-- vel type mux: (/teleop/cmd_vel & $(arg navigation_topic) & /input_vel/safe) -> /base_controller/command_unchecked -->
<node pkg="jsk_robot_startup" type="mux_selector.py" name="vel_type_selector"
respawn="true" output="screen" machine="$(arg machine)"
args="/joy 'm.buttons[10]==1' /teleop/cmd_vel /navigation/cmd_vel 'True' /navigation/cmd_vel">
args="/joy 'm.buttons[10]==1' /teleop/cmd_vel $(arg navigation_topic) 'True' $(arg navigation_topic)">
<remap from="mux" to="vel_type_mux" />
<param name="default_select" value="/input_vel/safe"/>
</node>
<!-- vel type mux with PS3 L1 button -->
<node pkg="topic_tools" type="mux" name="vel_type_mux"
respawn="true" machine="$(arg machine)"
args="/base_controller/command_unchecked /input_vel/safe /navigation/cmd_vel /teleop/cmd_vel">
args="/base_controller/command_unchecked /input_vel/safe $(arg navigation_topic) /teleop/cmd_vel">
<remap from="mux" to="vel_type_mux" />
</node>

Expand Down

0 comments on commit 41634d5

Please sign in to comment.