ROS Image_transport使用

原本想要用image_transport來將compressed圖像republish成raw的,結果使用過程當中遇到找不到image_transport.這一點很矛盾,由於一直都在用這個,一下是遇到的問題集錦;bash

1. 首先是找不到list_transport:.net

s———n@shinan:/opt/ros/kinetic/lib/image_transport$ rosrun image_transport list_transports 
[rosrun] Couldn't find executable named list_transports below /opt/ros/kinetic/share/image_transport

查找發現/opt/ros/kinetic/lib/image_transport 裏面有對應的list_transports的可執行文件,可是在share下沒有,將lib下對應的可執行文件list_transport和republish拷貝進去
而後便可執行rosrun image_transport list_transports;返回了對應的list:code

image_transport/compressed
image_transport/compressedDepth
image_transport/h264
image_transport/raw
image_transport/theora

可是執行:ip

rosrun image_transport republish compressed in:=/usb_cam150/image_raw raw out:=/usb_cam150/image_raw

仍是沒有反應,不會提示出錯,也不會終止程序
這時能夠嘗試播放包,好比個人:
rosbag play 2020-05-27-09-28-53.bagget

這個包的信息以下:同步

types:       sensor_msgs/CompressedImage [8f7a12909da2c9d3332d540a0977563f]
topics:      /usb_cam150/image_raw/compressed   3211 msgs    : sensor_msgs/CompressedImage
             /usb_cam180/image_raw/compressed   3211 msgs    : sensor_msgs/CompressedImage

s@s:/media/s/DATA/ROSbag/150+180/calib$ rosbag play 2020-05-27-09-28-53.bag 博客

可是若是同時運行播包和republish就能夠看到兩個多出來幾個個topic以下:io

/clock
/image_republisher_1597290710044689526/compressed/parameter_descriptions
/image_republisher_1597290710044689526/compressed/parameter_updates
/image_republisher_1597290789065015274/compressed/parameter_descriptions
/image_republisher_1597290789065015274/compressed/parameter_updates
/rosout
/rosout_agg
/usb_cam150/image_raw
/usb_cam150/image_raw/compressed
/usb_cam180/image_raw
/usb_cam180/image_raw/compressed

其中/usb_cam150/image_raw 和/usb_cam180/image_raw 是咱們須要的;table

總結來說,咱們的目的是將包含壓縮圖像的bag轉換成包含raw圖像的bag,所須要的指令以下:
先運行:class

rosrun  image_transport republish compressed in:=/usb_cam150/image_raw  raw  out:=/usb_cam150/image_raw
rosrun  image_transport republish compressed in:=/usb_cam180/image_raw  raw  out:=/usb_cam180/image_raw

再運行:

rosbag record -o raw.bag /usb_cam150/image_raw /usb_cam180/image_raw

最後運行:

rosbag play 2020-05-27-09-28-53.bag

 

本文同步分享在 博客「莫奈的三輪車」(CSDN)。
若有侵權,請聯繫 support@oschina.cn 刪除。
本文參與「OSC源創計劃」,歡迎正在閱讀的你也加入,一塊兒分享。

相關文章
相關標籤/搜索