Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jsk_data] Add common rosbag_record and play file for fetch #1611

Merged
merged 6 commits into from
Jul 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions jsk_data/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ if (CATKIN_ENABLE_TESTING)
roslaunch_add_file_check(launch/baxter_play.launch)
roslaunch_add_file_check(launch/baxter_record.launch)
endif()
find_package(fetch_description QUIET)
if(fetch_description_FOUND)
roslaunch_add_file_check(launch/fetch_play.launch)
roslaunch_add_file_check(launch/fetch_record.launch)
endif()
find_package(pr2_description QUIET)
if(pr2_description_FOUND)
roslaunch_add_file_check(launch/pr2_play.launch)
Expand Down
39 changes: 39 additions & 0 deletions jsk_data/launch/fetch_play.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<launch>
<!-- other file args -->
<arg name="bagfile_names" />
<arg name="launch_openni2" default="true"/>
<arg name="launch_robot_model" default="true"/>
<arg name="use_gui" default="false"/>
<arg name="rosbag_option" default="--clock --loop"/>
<arg name="use_xterm" default="false" />

<!-- set params for rviz -->
<param name="use_sim_time" value="true" />
<param if="$(arg launch_robot_model)"
name="robot_description" textfile="$(find fetch_description)/robots/fetch.urdf"/>

<!-- setup openni_launch -->
<include if="$(arg launch_openni2)"
file="$(find openni2_launch)/launch/openni2.launch">
<arg name="camera" value="head_camera"/>
<arg name="load_driver" value="false"/>
<arg name="depth_registration" value="true"/>
</include>

<group if="$(arg use_xterm)">
<node name="rosbag_play"
pkg="rosbag" type="play"
launch-prefix="xterm -e"
args="$(arg rosbag_option) $(arg bagfile_names)" />
</group>
<group unless="$(arg use_xterm)">
<node name="rosbag_play"
pkg="rosbag" type="play"
args="$(arg rosbag_option) $(arg bagfile_names)" />
</group>

708yamaguchi marked this conversation as resolved.
Show resolved Hide resolved
<node if="$(arg use_gui)" pkg="rqt_bag" type="rqt_bag" name="rqt_bag" />

<node if="$(arg use_gui)" pkg="rviz" type="rviz" name="rviz" />

</launch>
19 changes: 19 additions & 0 deletions jsk_data/launch/fetch_play.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

OPTIONS="--clock"
FILENAMES=""

while [[ $# -gt 0 ]]; do
case "$1" in
-*)
OPTIONS="$OPTIONS $1"
shift
;;
*)
FILENAMES="$FILENAMES $(readlink -f $1)"
shift
;;
esac
done

roslaunch jsk_data fetch_play.launch bagfile_names:="$FILENAMES" rosbag_option:="$OPTIONS"
44 changes: 44 additions & 0 deletions jsk_data/launch/fetch_record.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<launch>

<!-- for fetch -->
<arg name="save_dir" default="/tmp/fetch_rosbag"/>
<arg name="bagfile_prefix" default="data" />
<arg name="other_topics" default=""/>
<arg name="other_options" default=""/>
<arg name="save_openni2" default="true" />
<arg name="save_base_scan" default="true" />
<arg name="save_robot_model" default="true" />
<arg name="save_all_image" default="false" />
<arg name="camera_namespace" default="head_camera"/>
<arg name="machine" default="localhost" />

<!-- -->
<!-- Conditions -->
<!-- -->

<arg unless="$(arg save_base_scan)"
name="base_scan_topics" value="" />
<arg if ="$(arg save_base_scan)"
name="base_scan_topics" value="/base_scan" />

<arg unless="$(arg save_all_image)"
name="all_image_topics" value="" />
<arg if ="$(arg save_all_image)"
name="all_image_topics" value="-e .*/(image_raw|camera_info)" />

<!-- execute -->
<include file="$(find jsk_data)/launch/common_record.launch">
<arg name="save_openni" value="false" />
<arg name="save_openni2" value="$(arg save_openni2)" />
<arg name="save_robot_model" value="$(arg save_robot_model)" />
<arg name="save_all_image" value="$(arg save_all_image)" />
<arg name="camera_namespace" value="$(arg camera_namespace)" />
<arg name="save_dir" value="$(arg save_dir)" />
<arg name="bagfile_prefix" value="$(arg bagfile_prefix)" />
<arg name="other_options" value="$(arg other_options)" />
<arg name="other_topics" value="$(arg other_topics)
$(arg base_scan_topics)" />
<arg name="machine" value="$(arg machine)" />
</include>

</launch>