Kết nối ROS hai máy tính

KẾT NỐI ROS cho hai máy tính

Gỉa sử có 2 máy tính:

Máy 1: ground station tên là nguyen3620

ip là 134.59.129.159,

Máy 2: odroid

ip là 134.59.129.151

  • kiểm tra thiết lập tên và ip address: more /etc/hosts

  • edit với: sudo /etc/hosts, cần thiết lập cho may ground station và máy odroid

127.0.0.1 localhost

134.59.129.159 nguyen3620

134.59.133.151 odroid

.....

  • mở 1 terminal mới, trên máy ground station, đặt

export ROS_MASTER_URI=http://134.59.129.159:11311arrow-up-right

  • mở 1 terminal mới, trên máy odroid, đặt

export ROS_MASTER_URI=http://nguyen3620:11311arrow-up-right

  • check với lệnh

echo $ROS_MASTER_URI

Một số thông tin khác có thể cần check lại

echo $ROS_IP

echo $ROS_HOST_NAME

MỞ CÁC ỨNG DỤNG NHƯ GEDIT, CUTECOM, RQT_GRAPH TRÊN REMOTE COMPUTER

Từ máy ground station, mở 1 terminal, type

ssh odroid@134.59.129.151 -Y

(Hoặc ssh odroid@134.59.129.151 -X , for untrusted client??)

Nếu có warning:

MAVROS

http://wiki.ros.org/mavrosarrow-up-right

imu_pub

Publish IMU state

Published Topics

~imu/data ( sensor_msgs/Imuarrow-up-right)

  • Imu data, orientation computed by FCU

~imu/data_raw (sensor_msgs/Imuarrow-up-right )

  • Raw IMU data without orientation

~imu/mag (sensor_msgs/MagneticFieldarrow-up-right )

  • FCU compass data

~imu/temperature (sensor_msgs/Temperaturearrow-up-right)

  • Temperature reported by FCU (usually from barometer)

~imu/atm_pressure (sensor_msgs/FluidPressurearrow-up-right)

  • Air pressure.

DÙNG ỨNG DỤNG ROSTOPIC ECHO ĐỌC DỮ LIỆU IMU

rostopic echo /mavros/imu/data_raw

hoặc

rostopic echo /mavros/imu/data

Có kiểu sensor_msgs/Imu.msg

Trong đó angular_velocity có kiểu geometry_msgs/Vector3

Và Vector3 có 3 thành phần x, y, z

Có thể tra cứu thông tin trực tiếp trên ROS, dùng rosmsg show sensor_msgs/Imu

Do đó, ví dụ, muốn hiển thị thành phần x của angularvelocity trên rqt_graph , cần chọn

/mavros/imu/data/angular_velocity/x

DÙNG ỨNG DỤNG ROSTOPIC ECHO LƯU DỮ LIỆU IMU

Giả sử cần lưu dữ liệu trong home/android vào 1 file có tên imu14sept2017.txt

rostopic echo /mavros/imu/data >imu14sept2017.txt

DÙNG ỨNG DỤNG RQT_GRAPH

rosrun rqt_graph rqt_graph

rồi ví dụ chọn trên cửa sổ bên trên góc trái /mavros/imu/data/angular_velocity/x

COPY DỮ LIỆU GIỮA 2 COMPUTER KHI KẾT NỐI SSH

Syntax:

To copy a file from B to A while logged into B:

To copy a file from B to A while logged into A:

Vi du

scp imu_data.txt nguyen@134.59.129.159:/home/nguyen

scp -r odroid@odroid:/home/odroid/catkin_ws/src/i3s_img_proc /home/lhnguyen/catkin_ws/src

COPY FOLDER TỪ 1 COMPUTẺR TỚI COMPUTER KHÁC KHI KẾT NỐI SSH

ou can use secure copy (scp) with the recursive option (-r):

Alternatively, I recommend rsync because you can resume transfers if the connection breaks, and it intelligently transfers only the differences between files:

Note that in both cases you should be careful of trailing slashes: moving/path/to/local/dirtoremotehost:/path/to/remote/dir/results in/path/to/remote/dir/dir

Last updated