ROS1雲課→14可視化互動
之前介紹中所涉及的二維三維可視化和互動,如果對應實際傳感器,那麼需要更多資訊。
- 傳感器釋出頻率
- 傳感器時延
- 傳感器固定在機器人上的位置和姿态
- ……
其中,第三點和坐标系密切相關了。
主題與坐标系的關系
如果資料從真實世界中一個實體位置的特定傳感器資料釋出,主題必須有一個坐标系。例如,相對于機器人底盤的位置上有一個雷射傳感器(通常在輪式機器人兩個輪子的輪軸中間)。如果需要用雷射掃描資料去檢測環境中障礙物或者建構地圖,就必須對雷射傳感器和底盤所在的位置進行坐标轉換。在ROS系統中,帶有封包頭的消息除了具有時間戳(在不同的消息間進行資料同步非常重要)之外,還要附上frame_id(坐标系标簽)。坐标系标簽用于區分消息所屬的坐标系。
坐标系自身并沒有意義,需要的是它們之間的坐标變換。實際上,機器人的tf坐标變換樹都會有一個base_link作為根坐标系(或是地圖,如果運作導航包的話)。這樣,就能夠在rqt_tf_tree中通過對比根坐标系和其他坐标系檢視機器人相對于真實世界坐标系的運動。
啟動如下stdr環境:
roslaunch stdr_launchers server_with_map_and_gui_plus_robot.launch

機器人特寫:
rosrun rqt_tf_tree rqt_tf_tree
對應:
而對于現在的示例,隻需要知道它們能夠在某個坐标系内進行計算從一個坐标系變換到另外一個坐标系,而且包含時間延遲即可。還需要了解tf在系統中會以某個特定的頻率進行釋出,這樣它就會像子系統一樣允許周遊坐标變換樹以擷取其中任意兩個坐标系之間的轉換,并且可以在系統的任意節點中通過調用tf進行變換。
在rviz中檢視一下:
roslaunch stdr_launchers server_with_map_and_gui_plus_robot.launch
... logging to /home/shiyanlou/.ros/log/dac41a72-29f7-11ed-9d7c-0242ac110007/roslaunch-6310afb5667ca969528f210f-301.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://6310afb5667ca969528f210f:44463/
SUMMARY
========
PARAMETERS
* /rosdistro: kinetic
* /rosversion: 1.12.14
NODES
/
robot_manager (nodelet/nodelet)
robot_spawn_6310afb5667ca969528f210f_301_673361009853165653 (stdr_robot/robot_handler)
stdr_gui_node_6310afb5667ca969528f210f_301_6214498739113013351 (stdr_gui/stdr_gui_node)
stdr_server (stdr_server/stdr_server_node)
world2map (tf/static_transform_publisher)
auto-starting new master
process[master]: started with pid [311]
ROS_MASTER_URI=http://localhost:11311
setting /run_id to dac41a72-29f7-11ed-9d7c-0242ac110007
process[rosout-1]: started with pid [324]
started core service [/rosout]
process[robot_manager-2]: started with pid [327]
process[stdr_server-3]: started with pid [328]
process[world2map-4]: started with pid [329]
process[stdr_gui_node_6310afb5667ca969528f210f_301_6214498739113013351-5]: started with pid [330]
process[robot_spawn_6310afb5667ca969528f210f_301_673361009853165653-6]: started with pid [340]
[ INFO] [1662038003.277267214]: Loading map from image "/opt/ros/kinetic/share/stdr_resources/maps/sparse_obstacles.png"
[ INFO] [1662038003.365821274]: Read a 775 X 746 map @ 0.020 m/cell
[robot_spawn_6310afb5667ca969528f210f_301_673361009853165653-6] process has finished cleanly
log file: /home/shiyanlou/.ros/log/dac41a72-29f7-11ed-9d7c-0242ac110007/robot_spawn_6310afb5667ca969528f210f_301_673361009853165653-6*.log
[ WARN] [1662040231.980856267]: Map already loaded!
[ERROR] [1662040231.981109167]: Could not load map, maybe already loaded...
檢視sonar資料: