瓜大无人船踩坑记2
-
设备准备
- 手柄
- 电池(2块)
- 电台及天线
- 电台电池(12V)
- 网线1根
- 计算机
-
设置计算机网络
-
静态ip地址
-
网段:192.168.0.x
已占用的地址:
192.168.0.57 usv3-laptop 192.168.0.205 hans-linuxpc
-
工控机密码
123
-
-
设置工控机网络
-
静态ip地址,无需改动
-
连接键盘鼠标,使用
sudo gedit /etc/hosts
在其中添加你的pc:
192.168.0.x xxxxxx
-
-
远程连接服务器
-
ping测试
# usv3 # you can also ping usv3-laptop ping 192.168.0.57 # inet(usv) ping 192.168.0.11 # inet(land) ping 192.168.0.26
-
远程登录
ssh usv3@usv3-laptop
-
-
编译
cd ~/dev/catkin_ws_serial_03 catkin_make
-
推进器连接电源,并打开开关
【注意】:对于修正的版本,此后仅需在根目录下依次执行. ./sensor.sh . ./actuator.sh
并在个人PC上执行:
cd [YOU_PC_WORKSPACE] source devel/setup.bash export ROS_MASTER_URI=http://usv3-laptop:11311/ roslaunch my_serial_node joy.launch
如果需要查看rostopic的内容,必须先进行source
对于修正的版本,仅需:cd ~ . ./init.sh
-
依次连接SBG、GPS、推进器
赋权限:
dmesg | grep tty
看一下是不是3个,然后:
sudo chmod a+rw /dev/ttyUSB0 sudo chmod a+rw /dev/ttyUSB1 sudo chmod a+rw /dev/ttyUSB2
-
执行ros命令
记得每次都需要远程连接,并
cd ~/dev/catkin_ws_serial_03 source devel/setup.bash
随后:
roscore
执行:
roslaunch launch_files npu_asv_sensor.launch SUMMARY ======== CLEAR PARAMETERS * /ekf_se_ship3/ PARAMETERS * /ekf_se_ship3/acceleration_gains: [0.8, 0.0, 0.0, 0... * /ekf_se_ship3/acceleration_limits: [1.3, 0.0, 0.0, 0... * /ekf_se_ship3/base_link_frame: base_link * /ekf_se_ship3/control_config: [True, False, Fal... * /ekf_se_ship3/control_timeout: 0.2 * /ekf_se_ship3/debug: False * /ekf_se_ship3/debug_out_file: /path/to/debug/fi... * /ekf_se_ship3/deceleration_gains: [1.0, 0.0, 0.0, 0... * /ekf_se_ship3/deceleration_limits: [1.3, 0.0, 0.0, 0... * /ekf_se_ship3/frequency: 30 * /ekf_se_ship3/imu0: /imu_data1 * /ekf_se_ship3/imu0_config: [False, False, Fa... * /ekf_se_ship3/imu0_differential: False * /ekf_se_ship3/imu0_linear_acceleration_rejection_threshold: 0.8 * /ekf_se_ship3/imu0_nodelay: False * /ekf_se_ship3/imu0_pose_rejection_threshold: 0.8 * /ekf_se_ship3/imu0_queue_size: 5 * /ekf_se_ship3/imu0_relative: False * /ekf_se_ship3/imu0_remove_gravitational_acceleration: False * /ekf_se_ship3/imu0_twist_rejection_threshold: 0.8 * /ekf_se_ship3/initial_estimate_covariance: ['1e-9', 0, 0, 0,... * /ekf_se_ship3/map_frame: map * /ekf_se_ship3/odom0: /odom * /ekf_se_ship3/odom0_config: [True, True, Fals... * /ekf_se_ship3/odom0_differential: True * /ekf_se_ship3/odom0_nodelay: False * /ekf_se_ship3/odom0_pose_rejection_threshold: 5 * /ekf_se_ship3/odom0_queue_size: 10 * /ekf_se_ship3/odom0_relative: False * /ekf_se_ship3/odom0_twist_rejection_threshold: 1 * /ekf_se_ship3/odom1: example/odom * /ekf_se_ship3/odom1_config: [True, True, Fals... * /ekf_se_ship3/odom1_differential: False * /ekf_se_ship3/odom1_nodelay: False * /ekf_se_ship3/odom1_pose_rejection_threshold: 2 * /ekf_se_ship3/odom1_queue_size: 10 * /ekf_se_ship3/odom1_relative: True * /ekf_se_ship3/odom1_twist_rejection_threshold: 1 * /ekf_se_ship3/odom_frame: odom * /ekf_se_ship3/pose0: example/pose * /ekf_se_ship3/pose0_config: [True, True, Fals... * /ekf_se_ship3/pose0_differential: True * /ekf_se_ship3/pose0_nodelay: False * /ekf_se_ship3/pose0_queue_size: 5 * /ekf_se_ship3/pose0_rejection_threshold: 2 * /ekf_se_ship3/pose0_relative: False * /ekf_se_ship3/print_diagnostics: True * /ekf_se_ship3/process_noise_covariance: [0.05, 0, 0, 0, 0... * /ekf_se_ship3/publish_acceleration: False * /ekf_se_ship3/publish_tf: False * /ekf_se_ship3/sensor_timeout: 1 * /ekf_se_ship3/stamped_control: False * /ekf_se_ship3/transform_time_offset: 0.0 * /ekf_se_ship3/transform_timeout: 0.0 * /ekf_se_ship3/twist0: example/twist * /ekf_se_ship3/twist0_config: [False, False, Fa... * /ekf_se_ship3/twist0_nodelay: False * /ekf_se_ship3/twist0_queue_size: 3 * /ekf_se_ship3/twist0_rejection_threshold: 2 * /ekf_se_ship3/two_d_mode: True * /ekf_se_ship3/use_control: False * /ekf_se_ship3/world_frame: odom * /nmea_serial_driver_node_ship3/baud: 115200 * /nmea_serial_driver_node_ship3/frame_id: odom * /nmea_serial_driver_node_ship3/port: /dev/ttyUSB2 * /nmea_serial_driver_node_ship3/time_ref_source: gps * /nmea_serial_driver_node_ship3/useRMC: False * /rosdistro: kinetic * /rosversion: 1.12.14 NODES / ekf_se_ship3 (robot_localization/ekf_localization_node) imudata_sbg_ship3 (tutorial/imudata_sbg.py) listener_ship3 (my_serial_node/listener) nmea_serial_driver_node_ship3 (nmea_navsat_driver/nmea_serial_driver) odom_trans_ship3 (tutorial/odom_trans_npu.py) sbg_serial_ship3 (my_serial_node/sbg_serial) sonar_listener_ship3 (my_serial_node/sonar_listener) sonar_serial_ship3 (my_serial_node/sonar_serial) utm_odometry_node_ship3 (gps_common/utm_odometry_node) ROS_MASTER_URI=http://localhost:11311 process[sbg_serial_ship3-1]: started with pid [10077] process[listener_ship3-2]: started with pid [10078] process[nmea_serial_driver_node_ship3-3]: started with pid [10088] process[sonar_listener_ship3-4]: started with pid [10101] process[sonar_serial_ship3-5]: started with pid [10104] process[utm_odometry_node_ship3-6]: started with pid [10112] process[imudata_sbg_ship3-7]: started with pid [10121] process[odom_trans_ship3-8]: started with pid [10127] [ERROR] [1606464842.121274597]: Unable to open Sonarport process[ekf_se_ship3-9]: started with pid [10149]
亦可执行:
. ./sensor.sh
-
执行ros命令
执行:
roslaunch launch_files npu_asv_actuator.launch NODES / talker_ship3 (my_serial_node/talker_ship2u1) thrust_serial_ship3 (my_serial_node/thrust_serial) ROS_MASTER_URI=http://localhost:11311 process[talker_ship3-1]: started with pid [3178] process[thrust_serial_ship3-2]: started with pid [3179]
亦可执行:
. ./actuator.sh
-
启动遥控节点
cd [YOU_PC_WORKSPACE] source devel/setup.bash export ROS_MASTER_URI=http://usv3-laptop:11311/ roslaunch my_serial_node joy.launch
启动情况:
NODES / joy_node (joy/joy_node) joy_prop (my_serial_node/joy_prop.py) ROS_MASTER_URI=http://usv3-laptop:11311/ process[joy_prop-1]: started with pid [3955] process[joy_node-2]: started with pid [3956]
备注:修正版本的记录。
-
绑定USB端口位置与传感器
作用:无需按顺序插线即可正常连接传感器。
参考:https://blog.csdn.net/weixin_45258318/article/details/110946148
-
修改代码中关于USB号的部分
修改的文件与内容如下:
-
/src/mypackage/my_serial_node/src/sbg_serial.cpp
ros::init(argc, argv, "sbg_serial"); ros::NodeHandle n; //发布主题sensor ros::Publisher sensor_pub = n.advertise<my_serial_node::serialmsg>("sbg_yaw", 1000); try { //sbg_ser.setPort("/dev/ttyUSB0"); sbg_ser.setPort("/dev/sbg"); sbg_ser.setBaudrate(115200); serial::Timeout to = serial::Timeout::simpleTimeout(1000); sbg_ser.setTimeout(to); sbg_ser.open(); }
-
/src/mypackage/my_serial_node/src/thrust_serial.cpp
ros::init(argc, argv, "serial1"); ros::NodeHandle n; //订阅主题command ros::Subscriber command_sub = n.subscribe("command", 1000, callback); try { //thrust_ser.setPort("/dev/ttyUSB2"); thrust_ser.setPort("/dev/thrust"); thrust_ser.setBaudrate(115200); serial::Timeout to = serial::Timeout::simpleTimeout(1000); thrust_ser.setTimeout(to); thrust_ser.open(); }
-
/src/mypackage/nmea_navsat_driver/launch/nmea_serial_driver.launch
<launch> <!-- A simple launch file for the nmea_serial_driver node. --> <!--<arg name="port" default="/dev/ttyUSB1" />--> <arg name="port" default="/dev/gps" /> <arg name="baud" default="115200" /> <arg name="frame_id" default="odom" /> <arg name="time_ref_source" default="gps" /> <arg name="useRMC" default="false" /> <node name="nmea_serial_driver_node" pkg="nmea_navsat_driver" type="nmea_serial_driver" output="log"> <param name="port" value="$(arg port)"/> <param name="baud" value="$(arg baud)" /> <param name="frame_id" value="$(arg frame_id)" /> <param name="time_ref_source" value="$(arg time_ref_source)" /> <param name="useRMC" value="$(arg useRMC)" /> </node> </launch>
-