Skip to content

Commit

Permalink
fix record/play bag function to show compressed camera images in rviz2
Browse files Browse the repository at this point in the history
DCO 1.1 Signed-off-by: Tatsuya Ishihara <[email protected]>
  • Loading branch information
tatsuya-ishihara committed Apr 11, 2024
1 parent 67006a5 commit 7a7841d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions docker/ros2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ RUN apt update && \
qtbase5-dev \
ros-$ROS_DISTRO-diagnostic-aggregator \
ros-$ROS_DISTRO-gazebo-msgs \
ros-$ROS_DISTRO-image-transport-plugins \
ros-$ROS_DISTRO-joint-state-publisher \
ros-$ROS_DISTRO-joint-state-publisher-gui \
ros-$ROS_DISTRO-navigation2 \
Expand Down
9 changes: 9 additions & 0 deletions script/play_bag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ if (( $(echo "$start > 0.01" | bc -l) )); then
temp_file="robot:=$temp_file"
fi

# republish uncompressed images to visualize in rviz2
readarray -t compressed_image_topics < <(ros2 bag info $bag | grep -oP '(?<=Topic: ).*(?=/compressed )')
for compressed_image_topic in "${compressed_image_topics[@]}"; do
com="ros2 run image_transport republish compressed --ros-args -r in/compressed:=$compressed_image_topic/compressed -r out:=$compressed_image_topic &"
echo $com
eval $com
pids+=($!)
done

com="ros2 launch cabot_debug play_bag.launch.py \
bagfile:=$bag \
start:=$start \
Expand Down
1 change: 0 additions & 1 deletion script/rosbag2-exclude-topics.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
^/bond$
^/clock$
^/local/bond$
^/.*/camera_info$
^/carto.*$
^.*image_rect_raw.*$
^.*aligned_depth_to_color.*$
Expand Down

0 comments on commit 7a7841d

Please sign in to comment.