UUV Simulator: Based on Gazebo
使用版本:Ubuntu20.04 + ros Noetic + gazebo 11
下载
https://github.com/arturmiller/uuv_simulator/tree/noetic
或者直接通过命令行下载
在uuv_ws/src中下载uuvsimulator
git clone https://github.com/uuvsimulator/eca_a9.git
在uuv_ws/src中下载rca_a9
git clone --branch noetic https://github.com/arturmiller/uuv_simulator.git
编译及环境变量配置
cd ~/uuv_ws
catkin build 或者catkin_make
source ./devel/setup.bash
运行rexrov仿真
roslaunch uuv_gazebo start_pid_demo_with_teleop.launch
rosbag record -O sim_20240225.bag /gazebo/model_states /rexrov/gps /rexrov/dvl /rexrov/imu /rexrov/thruster_manager/input_stamped /rexrov/pressure
运行auv仿真
运行海洋环境
roslaunch uuv_gazebo_worlds ocean_waves.launch
启动auv
roslaunch eca_a9_gazebo start_demo_teleop.launch joy_id:=0
在gazebo中选定model,点击moveto 可以直接切换到模型位置
apply force and torque可以通过界面直接对模型加力、力矩
推进相关参数
一共8个推进器thruster,z方向4个(垂直zy平面放置,thruster0-3),xy方向4个(与航行器xy方向呈45°安装,thruster4-7)
/rexrov/thruster_manager/input 没返回结果
/rexrov/thruster_manager/input_stamped
/rexrov/thrusters/0/dynamic_state_efficiency 返回1.0
/rexrov/thrusters/0/input 没返回结果
/rexrov/thrusters/0/is_on 返回True
/rexrov/thrusters/0/thrust 没返回结果
/rexrov/thrusters/0/thrust_efficiency 返回1.0
/rexrov/thrusters/0/thrust_wrench
rostopic echo /rexrov/thruster_manager/input_stamped
header:
seq: 30972
stamp:
secs: 1549
nsecs: 352000000
frame_id: "/rexrov//base_link"
wrench:
force:
x: 0.14336376920744176
y: 5.187497775269088e-07
z: -259.6735869189972
torque:
x: 0.07349974610418746
y: -0.0734997393189873
z: 4.064592808484786e-05
---
rostopic echo /rexrov/thrusters/0/thrust_wrench
header:
seq: 20677
stamp:
secs: 1033
nsecs: 900000000
frame_id: "rexrov/thruster_0"
wrench:
force:
x: -67.33864373625269
y: -3.738045636150916e-15
z: 2.803534227113187e-15
torque:
x: 0.0
y: 0.0
z: 0.0
---
rostopic echo /rexrov/thrusters/1/thrust_wrench
header:
seq: 33143
stamp:
secs: 1657
nsecs: 200000000
frame_id: "rexrov/thruster_1"
wrench:
force:
x: -67.42879489024459
y: 3.7430500304938324e-15
z: 2.807287522870374e-15
torque:
x: 0.0
y: 0.0
z: 0.0
---
rostopic echo /rexrov/thruster_manager/input
WARNING: no messages received and simulated time is active.Is /clock being published?
rostopic echo /rexrov/thrusters/0/thrust_efficiency
data: 1.0
---
data: 1.0
---
rostopic echo /rexrov/thrusters/0/dynamic_state_efficiency
data: 1.0
---
data: 1.0
---
键盘控制运动
运行键盘代码,代码在miscauv@ubuntu:~/uuvsimulator_ws/src/uuv_simulator-noetic/uuv_teleop/launch/uuv_keyboard_teleop.launch
打开新窗口运行键盘控制程序需要source ./devel/setup.bash
roslaunch uuv_keyboard_teleop.launch uuv_name:=rexrov
直接发送速度消息
打开新窗口运行键盘控制程序需要source ./devel/setup.bash
rostopic pub -r 10 /rexrov/cmd_vel geometry_msgs/Twist '{linear: {x: 1, y: 0, z: 0}, angular: {x: 0, y: 0, z: 0}}'
用键盘控制运动(需选定在此终端进行按键)
在Rviz中通过Odometry的箭头可以看到运动
查看仿真真值
rostopic echo /gazebo/model_states
查看向航行器发送的速度
rostopic echo /rexrov/cmd_vel
查看gps数据
rostopic echo /rexrov/gps
查看imu数据
rostopic echo /rexrov/imu
查看DVL时提示????
ERROR: Cannot load message class for [uuv_sensor_ros_plugins_msgs/DVL]. Are your messages built?
解决:
查看以下都有数据
/rexrov/dvl
/rexrov/dvl/state
/rexrov/dvl_sonar0
/rexrov/dvl_twist
在该终端的worspace运行
source devel/setup.bash
问题:
RLException: [uuv_keyboard_teleop.launch] requires the ‘uuv_name’ arg to be set The traceback for the exception was written to the log file
解决:需要加uuv_name:=rexrov
问题:
rostopic list里有/rexrov/dvl
但运行rostopic echo /rexrov/dvl时报错
ERROR: Cannot load message class for [uuv_sensor_ros_plugins_msgs/DVL]. Are your messages built?
解决: source ./devel/setup.bash
问题:
通过键盘控制运动,接收不到/cmd_vel消息
rosrun teleop_twist_keyboard teleop_twist_keyboard.py
Waiting for subscriber to connect to /cmd_vel
Waiting for subscriber to connect to /cmd_vel
Waiting for subscriber to connect to /cmd_vel
pub -r 10 /cmd_vel geometry_msgs/Twist控制运动没有反应
查看/cmd_vel消息报错:
rostopic echo /rexrov/cmd_vel
WARNING: no messages received and simulated time is active.
Is /clock being published?
解决:
1.