一、Gazebo中实现机器人仿真(小白上手)+ubuntu18.04

一、Gazebo和环境模型准备
二、机器人模型设计
三、为模型上装备传感器和执行器

目标:设计一台具备激光雷达、IMU和相机的机器人仿真模型用于避障和路径规划

1、\安装 bingda_tutorials包:git clone https://gitee.com/bingda-robot/bingda_tutorials

cd catkin_ws/src/bingda_tutorials/
git reset --hard
git pull origin master
cd ..
git clone https://gitee.com/bingda-robot/bingda_tutorials
cd ..
编译:
catkin_make --pkg bingda_tutorial

2、\安装依赖功能包

cd catkin_ws
sudo apt update
sudo apt install ros-$ROS_DISTRO-gazebo-ros ros-$ROS_DISTRO-gazebo-ros-control ros-$ROS_DISTRO-gazebo-plugins ros-$ROS_DISTRO-joint-state-publisher ros-$ROS_DISTRO-joint-state-publisher-gui ros-$ROS_DISTRO-robot-state-publisher

3、\实验

确定gazebo正常运行
打开终端:gazebo
创建并保存:room.world
cd catkin_ws
source ./devel/setup.bash
roslaunch bingda_tutorials gazebo_world.launch

4、\准备机器人模型:urdf -ROS WiKi

cd catkin_ws/src/bingda_tutorials/urdf
check_urdf mybot.urdf
cd catkin_ws
source ./devel/setup.bash
roslaunch bingda_tutorials display_robot.launch

    \出错:Traceback (most recent call last):
  File "/opt/ros/melodic/lib/joint_state_publisher_gui/joint_state_publisher_gui", line 50, in <module>
    jsp_gui = joint_state_publisher_gui.JointStatePublisherGui('Joint State Publisher', 
  AttributeError: module 'joint_state_publisher_gui' has no attribute 'JointStatePublisherGui'. Did you mean: 'JofloatStatePublisherGui'?
  [joint_state_publisher_gui-3] process has died [pid 18832, exit code 1, cmd /opt/ros/melodic/lib/joint_state_publisher_gui/joint_state_publisher_gui __name:=joint_state_publisher_gui __log:=/home/xu/.ros/log/82bf5c0e-1453-11ef-b89b-347df6d69705/joint_state_publisher_gui-3.log].
  log file: /home/xu/.ros/log/82bf5c0e-1453-11ef-b89b-347df6d69705/joint_state_publisher_gui-3*.log
   \问题尚未解决

roslaunch bingda_tutorials gazebo_robot.launch

5、\给机器人增加执行器和传感器

文件:xacro -ROS WiKi或http www ros org wiki xacro
cd catkin_ws
source ./devel/setup.bash
roslaunch bingda_tutorials simulation_robot.launch
打开新的终端:
rostopic list
rostopic info /cmd_vel
rqt_image_view
新终端:
rosrun teleop_twist_keyboard teleop_twist_keyboard.py

通过实践, 发现各个键值的作用如下:
u-- 向左前方前进   i-- 直行前进   o-- 向右前方前进   j-- 逆时针旋转   k-- 停止   l-- 顺时针旋转   m-- 向左后方后退   ,-- 后退
. – 向右后方后退
q – 增加速度
z – 减小速度

新终端:rviz
Add-TF-RobotModel-LaserScan:Topic:/scan;Size(m):o.03
控制键盘建来控制小车运动

参考博主:

【70分钟快速入门Gazebo机器人仿真】 https://www.bilibili.com/video/BV143411C75B/?p=6&share_source=copy_web&vd_source=7e0f2c799fb46162b4921e238f945f78

  • 5
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值