1. 程式人生 > 其它 >ros多機通訊網路設定、建圖

ros多機通訊網路設定、建圖

ros小車網路設定

編輯 bashrc

wheeltec@wheeltec:~$ 
wheeltec@wheeltec:~$ nano .bashrc
wheeltec@wheeltec:~$ 
export ROS_MASTER_URI=http://192.168.0.100:11311
export ROS_HOSTNAME=192.168.0.100    

儲存更改

wheeltec@wheeltec:~$ 
wheeltec@wheeltec:~$ 
wheeltec@wheeltec:~$ source .bashrc
wheeltec@wheeltec:~$ 

本機網路設定

bim@bim-ThinkPad-T440p:~$ 
bim@bim-ThinkPad-T440p:~$ nano .bashrc
bim@bim-ThinkPad-T440p:~$ 
bim@bim-ThinkPad-T440p:~$ 
export ROS_MASTER_URI=http://192.168.0.100:11311     #ROS小車 的 ip地址
export ROS_HOSTNAME=192.168.0.223  #本機的 ip地址

儲存更改

bim@bim-ThinkPad-T440p:~$ 
bim@bim-ThinkPad-T440p:~$ source .bashrc
bim@bim-ThinkPad-T440p:~$ 

建圖

ROS小車執行建圖命令: roslaunch turn_on_wheeltec_robot mapping.launch

wheeltec@wheeltec:~$ 
wheeltec@wheeltec:~$ 
wheeltec@wheeltec:~$ roslaunch turn_on_wheeltec_robot mapping.launch
... logging to /home/wheeltec/.ros/log/d8a32938-09fe-11eb-90b8-dca632c35b35/roslaunch-wheeltec-2332.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is 
<1GB. started roslaunch server http://192.168.0.100:35923/ SUMMARY ======== PARAMETERS * /robot_description: <?xml version="1.... * /robot_pose_ekf/freq: 30.0 * /robot_pose_ekf/imu_used: True * /robot_pose_ekf/odom_used: True * /robot_pose_ekf/sensor_timeout: 2.0 * /robot_pose_ekf/vo_used: False * /rosdistro: melodic * /rosversion: 1.14.5 * /rplidarNode/angle_compensate: True * /rplidarNode/frame_id: laser * /rplidarNode/inverted: False * /rplidarNode/serial_baudrate: 115200 * /rplidarNode/serial_port: /dev/rplidar_laser * /slam_gmapping/angularUpdate: 0.0436 * /slam_gmapping/astep: 0.05 * /slam_gmapping/base_frame: base_footprint * /slam_gmapping/delta: 0.05 * /slam_gmapping/iterations: 5 * /slam_gmapping/kernelSize: 3 * /slam_gmapping/lasamplerange: 0.005 * /slam_gmapping/lasamplestep: 0.005 * /slam_gmapping/linearUpdate: 0.05 * /slam_gmapping/llsamplerange: 0.01 * /slam_gmapping/llsamplestep: 0.01 * /slam_gmapping/lsigma: 0.075 * /slam_gmapping/lskip: 0 * /slam_gmapping/lstep: 0.05 * /slam_gmapping/map_update_interval: 0.01 * /slam_gmapping/maxRange: 5.0 * /slam_gmapping/maxUrange: 4.0 * /slam_gmapping/minimumScore: 30 * /slam_gmapping/odom_frame: odom_combined * /slam_gmapping/ogain: 3.0 * /slam_gmapping/particles: 8 * /slam_gmapping/resampleThreshold: 0.5 * /slam_gmapping/sigma: 0.05 * /slam_gmapping/srr: 0.01 * /slam_gmapping/srt: 0.02 * /slam_gmapping/str: 0.01 * /slam_gmapping/stt: 0.02 * /slam_gmapping/temporalUpdate: -1.0 * /slam_gmapping/xmax: 1.0 * /slam_gmapping/xmin: -1.0 * /slam_gmapping/ymax: 1.0 * /slam_gmapping/ymin: -1.0 * /velocity_smoother/accel_lim_v: 0.1 * /velocity_smoother/accel_lim_w: 0.2 * /velocity_smoother/decel_factor: 1.0 * /velocity_smoother/frequency: 20.0 * /velocity_smoother/robot_feedback: 0 * /velocity_smoother/speed_lim_v: 0.2 * /velocity_smoother/speed_lim_w: 0.4 * /wheeltec_robot/product_number: 0 * /wheeltec_robot/robot_frame_id: base_footprint * /wheeltec_robot/serial_baud_rate: 115200 * /wheeltec_robot/smoother_cmd_vel: smoother_cmd_vel * /wheeltec_robot/usart_port_name: /dev/wheeltec_con... NODES / base_to_camera (tf/static_transform_publisher) base_to_gyro (tf/static_transform_publisher) base_to_laser (tf/static_transform_publisher) base_to_link (tf/static_transform_publisher) joint_state_publisher (joint_state_publisher/joint_state_publisher) nodelet_manager (nodelet/nodelet) robot_pose_ekf (robot_pose_ekf/robot_pose_ekf) robot_state_publisher (robot_state_publisher/robot_state_publisher) rplidarNode (rplidar_ros/rplidarNode) slam_gmapping (gmapping/slam_gmapping) velocity_smoother (nodelet/nodelet) wheeltec_robot (turn_on_wheeltec_robot/wheeltec_robot_node) auto-starting new master process[master]: started with pid [2361] ROS_MASTER_URI=http://192.168.0.100:11311 setting /run_id to d8a32938-09fe-11eb-90b8-dca632c35b35 process[rosout-1]: started with pid [2375] started core service [/rosout] process[base_to_link-2]: started with pid [2378] process[base_to_gyro-3]: started with pid [2379] process[base_to_laser-4]: started with pid [2380] process[base_to_camera-5]: started with pid [2381] process[rplidarNode-6]: started with pid [2382] process[wheeltec_robot-7]: started with pid [2389] process[robot_pose_ekf-8]: started with pid [2409] [ INFO] [1602227578.190353828]: wheeltec_robot node has turned on process[joint_state_publisher-9]: started with pid [2418] [ INFO] [1602227578.237645643]: RPLIDAR running on ROS package rplidar_ros. SDK Version:1.12.0 process[robot_state_publisher-10]: started with pid [2422] process[nodelet_manager-11]: started with pid [2428] [ INFO] [1602227578.337306532]: Data ready process[velocity_smoother-12]: started with pid [2430] [ INFO] [1602227578.359143606]: wheeltec_robot serial port opened [ INFO] [1602227578.399506310]: output frame: odom_combined [ INFO] [1602227578.408091365]: base frame: base_footprint process[slam_gmapping-13]: started with pid [2432] [ INFO] [1602227578.789265698]: Initializing Odom sensor [ INFO] [1602227578.789400254]: Odom sensor activated [ INFO] [1602227578.789648106]: Initializing Imu sensor [ INFO] [1602227578.789719328]: Imu sensor activated [ INFO] [1602227578.822441661]: Kalman filter initialized with odom measurement RPLIDAR S/N: CE999A87C5E392D3A5E49EF05E4C3D65 [ INFO] [1602227580.759699123]: Firmware Ver: 1.25 [ INFO] [1602227580.759940438]: Hardware Rev: 5 [ INFO] [1602227580.761591179]: RPLidar health status : 0 [ INFO] [1602227581.311162289]: current scan mode: Express, max_distance: 12.0 m, Point number: 4.0K , angle_compensate: 1 [ INFO] [1602227581.990280993]: Laser is mounted upwards. -maxUrange 4 -maxUrange 5 -sigma 0.05 -kernelSize 3 -lstep 0.05 -lobsGain 3 -astep 0.05 -srr 0.01 -srt 0.02 -str 0.01 -stt 0.02 -linearUpdate 0.05 -angularUpdate 0.0436 -resampleThreshold 0.5 -xmin -1 -xmax 1 -ymin -1 -ymax 1 -delta 0.05 -particles 8 [ INFO] [1602227581.996790567]: Initialization complete update frame 0 update ld=0 ad=0 Laser Pose= 0.0327956 -0.000775587 -3.13293 m_count 0 Registering First Scan update frame 243 update ld=0.0500759 ad=0.000210844 Laser Pose= 0.0372805 -0.0014034 -3.1329 m_count 1 Average Scan Matching Score=247.832 neff= 8 Registering Scans:Done update frame 489 update ld=0.0500768 ad=0.000213694 Laser Pose= 0.0363343 -0.000864417 -3.13291 m_count 2 Average Scan Matching Score=248.212 neff= 8 Registering Scans:Done update frame 751 update ld=0.0501986 ad=0.000222049 Laser Pose= 0.0366387 -0.00127478 -3.13291 m_count 3 Average Scan Matching Score=254.195 neff= 8 Registering Scans:Done update frame 1004 update ld=0.0501093 ad=0.000224619 Laser Pose= 0.0366602 -0.000874876 -3.13291 m_count 4 Average Scan Matching Score=246.565 neff= 8 Registering Scans:Done update frame 1261 update ld=0.0501378 ad=0.000219669 Laser Pose= 0.0366402 -0.0012214 -3.13291 m_count 5 Average Scan Matching Score=244.527 neff= 8 Registering Scans:Done update frame 1520 update ld=0.0500917 ad=0.000212962 Laser Pose= 0.0368401 -0.00101945 -3.13291 m_count 6 Average Scan Matching Score=249.25 neff= 8 Registering Scans:Done [ INFO] [1602227805.522305285]: Odom sensor not active any more [ INFO] [1602227805.522497322]: Imu sensor not active any more [ INFO] [1602227806.548018303]: Initializing Odom sensor [ INFO] [1602227806.548471174]: Initializing Imu sensor [ INFO] [1602227806.597893970]: Odom sensor activated [ INFO] [1602227806.598265359]: Imu sensor activated update frame 1763 update ld=0.0500406 ad=0.000218761 Laser Pose= 0.0368585 -0.0012703 -3.13291 m_count 7 Average Scan Matching Score=250.187 neff= 7.99999 Registering Scans:Done update frame 1998 update ld=0.0500109 ad=0.000214344 Laser Pose= 0.0364999 -0.00114887 -3.13291 m_count 8 Average Scan Matching Score=248.247 neff= 7.99999 Registering Scans:Done update frame 2246 update ld=0.0500389 ad=0.000212308 Laser Pose= 0.0370197 -0.000398138 -3.13291 m_count 9 Average Scan Matching Score=245.376 neff= 7.99998 Registering Scans:Done update frame 2481 update ld=0.0500089 ad=0.0002063 Laser Pose= 0.0371468 9.82777e-06 -3.1329 m_count 10 Average Scan Matching Score=243.232 neff= 7.99997 Registering Scans:Done [ INFO] [1602227919.522293106]: Odom sensor not active any more [ INFO] [1602227919.522478588]: Imu sensor not active any more [ INFO] [1602227920.552385754]: Initializing Odom sensor [ INFO] [1602227920.552785995]: Initializing Imu sensor [ INFO] [1602227920.602425291]: Odom sensor activated [ INFO] [1602227920.602800976]: Imu sensor activated update frame 2725 update ld=0.0500577 ad=0.00021108 Laser Pose= 0.0370274 -0.000783038 -3.13291 m_count 11 Average Scan Matching Score=249.93 neff= 7.99996 Registering Scans:Done update frame 2968 update ld=0.0500298 ad=0.000210069 Laser Pose= 0.0369282 -0.00116905 -3.13291 m_count 12 Average Scan Matching Score=249.292 neff= 7.99995 Registering Scans:Done update frame 3215 update ld=0.0500075 ad=0.000218644 Laser Pose= 0.0368599 -0.00106197 -3.13291 m_count 13 Average Scan Matching Score=246.267 neff= 7.99995 Registering Scans:Done update frame 3485 update ld=0.0500489 ad=0.00021138 Laser Pose= 0.0363126 -0.00094431 -3.13291 m_count 14 Average Scan Matching Score=248.305 neff= 7.99995 Registering Scans:Done update frame 3739 update ld=0.0501318 ad=0.000213618 Laser Pose= 0.0381321 -0.000421159 -3.1329 m_count 15 Average Scan Matching Score=247.348 neff= 7.99995 Registering Scans:Done update frame 4024 update ld=0.0502469 ad=0.000203066 Laser Pose= 0.0366177 -0.00130872 -3.13291 m_count 16 Average Scan Matching Score=243.318 neff= 7.99995 Registering Scans:Done ^C[slam_gmapping-13] killing on exit [velocity_smoother-12] killing on exit [nodelet_manager-11] killing on exit [robot_state_publisher-10] killing on exit [joint_state_publisher-9] killing on exit [robot_pose_ekf-8] killing on exit [wheeltec_robot-7] killing on exit [rplidarNode-6] killing on exit [base_to_camera-5] killing on exit [base_to_laser-4] killing on exit virtual GMapping::GridSlamProcessor::~GridSlamProcessor(): Start virtual GMapping::GridSlamProcessor::~GridSlamProcessor(): Deleting tree

客戶端執行檢視:rviz

bim@bim-ThinkPad-T440p:~$ 
bim@bim-ThinkPad-T440p:~$ rviz
[ INFO] [1633338343.824862477]: rviz version 1.13.17
[ INFO] [1633338343.824909142]: compiled against Qt version 5.9.5
[ INFO] [1633338343.824919461]: compiled against OGRE version 1.9.0 (Ghadamon)
[ INFO] [1633338343.887736534]: Forcing OpenGl version 0.
[ INFO] [1633338344.412981061]: Stereo is NOT SUPPORTED
[ INFO] [1633338344.413033180]: OpenGL device: Mesa DRI Intel(R) HD Graphics 4600 (HSW GT2)
[ INFO] [1633338344.413050833]: OpenGl version: 3.0 (GLSL 1.3).
[ INFO] [1633338363.383202924]: Creating 1 swatches
[ INFO] [1633338398.537894135]: Creating 1 swatches

新增map、TF,資料顯示正常:

###################

QQ 3087438119