Airsim动态 | 安装ROS包装器(AirSim ROS Wrapper)

file 本期内容我们将带来在Airsim环境下使用ROS Wrapper的相关教程,以下是AirSim客户端库上的一些ROS Wrapper相关配置。

一、启动

以下步骤适用于 Linux 系统。如果是在 Windows 上运行 AirSim,可以使用 Windows Subsystem for Linux (WSL) 来运行 ROS 包装器,如果不想在主机上安装ROS相关工具,也可以使用Docker容器进行安装。请检查下方内容并按照需求安装,具体内容可以参照最后网址。

如果您的默认 GCC 版本不是8或更高版本(检查使用命令gcc --version)

a) 安装 gcc >= 8.0.0:sudo apt-get install gcc-8 g++-8 b) 验证安装 gcc-8 --version

如果是Ubuntu 18.04版本 a) 安装ROS melodic版本 b) 安装 tf2 传感器和 mavros 包: sudo apt-get install ros-kinetic-tf2-sensor-msgs ros-kinetic-tf2-geometry-msgs ros-kinetic-mavros*

如果是Ubuntu 16.04版本 a) 安装ROS Kinetic版本 b)安装 tf2 传感器和 mavros 包: sudo apt-get install ros-melodic-tf2-sensor-msgs ros-melodic-tf2-geometry-msgs ros-melodic-mavros*

如果是Ubuntu 20.04版本 a) 安装ROS noetic版本 b) 安装 tf2 传感器和 mavros 包: sudo apt-get install ros-melodic-tf2-sensor-msgs ros-melodic-tf2-geometry-msgs ros-melodic-mavros*

安装catkin_tools: sudo apt-get install python-catkin-tools 或pip install catkin_tools. 如果使用的Ubuntu是20.04版本,请使用以下安装命令: pip install "git+https://github.com/catkin/catkin_tools.git#egg=catkin_tools"

网址推荐: 1.WSL在Win10上构建环境: https://microsoft.github.io/AirSim/airsim_ros_pkgs/#setting-up-the-build-environment-on-windows10-using-wsl1-or-wsl2

2.使用Docker: https://microsoft.github.io/AirSim/airsim_ros_pkgs/#using-docker-for-ros

二、构建环境

构建AirSim: git clone https://github.com/Microsoft/AirSim.git; cd AirSim; ./setup.sh; ./build.sh; 确定已按照上述界面安装好并为ROS 设置了环境变量。方便起见,将“source”命令添加到自己的【.bashrc】上(替换melodic为特定版本名称)。 echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc source ~/.bashrc

构建ROS包 cd ros; catkin build; # or catkin_make

请注意,如果自己默认GCC版本不是8以上的版本,则会导致编译失败,在这种情况下,可以使用【gcc-8】明确这一点: catkin build -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8

三、运行 source devel/setup.bash; roslaunch airsim_ros_pkgs airsim_node.launch; roslaunch airsim_ros_pkgs rviz.launch; 注意:如果运行时出现错误:

注意:如果运行时出现错误: roslaunch airsim_ros_pkgs airsim_node.launch 则可以使用命令catkin clean清除并重新运行。

四、使用AirSim ROS wrapper功能包 ROS wrapper由两个 ROS 节点组成——第一个是 AirSim 的多旋翼C++ 客户端库的包装器,第二个是一个简单的 PD 位置控制器。

关于订阅和发布节点,参数与service可以参考网址: https://microsoft.github.io/AirSim/airsim_ros_pkgs/#airsim-ros-wrapper-node

PID位置控制器节点可以参考: https://microsoft.github.io/AirSim/airsim_ros_pkgs/#simple-pid-position-controller-node

  • End -

技术发展的日新月异,阿木实验室将紧跟技术的脚步,不断把机器人行业最新的技术和硬件推荐给大家。看到经过我们培训的学员在技术上突飞猛进,是我们培训最大的价值。如果你在机器人行业,就请关注我们的公众号,我们将持续发布机器人行业最有价值的信息和技术。 阿木实验室致力于前沿IT科技的教育和智能装备,让机器人研发更高效!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章