UUVsimulator仿真

本文详细介绍了如何在Ubuntu20.04和ROSNoetic环境下,基于Gazebo11安装并运行UUVSimulator,用于RexROV和AUV的仿真。通过git克隆源码、catkin构建以及设置环境变量,用户可以启动RexROV和AUV的仿真场景,并使用键盘控制运动。同时,文章还涵盖了传感器数据的查看,如GPS、IMU和DVL,并解决了一些常见问题。
摘要由CSDN通过智能技术生成

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.

  • 9
    点赞
  • 49
    收藏
    觉得还不错? 一键收藏
  • 14
    评论
评论 14
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值