首页 > 其他分享 >深蓝学院—机器人学基础学习笔记——第一章(环境配置)

深蓝学院—机器人学基础学习笔记——第一章(环境配置)

时间:2022-08-13 03:31:22浏览次数:89  
标签:noetic catkin make sudo 深蓝 第一章 ws install 机器人学

chapter1-homework

前言

​ 因为课程建议使用ros-melodic版本,但我此前已经在ubuntu20.04安装了ros-noetic版本,安装过程出了点小插曲,故此简单记录下ros-noetic版本下安装Turtlebot2的过程,给大家排排雷,如有不足之处欢迎广大同仁批评指正,以免误人子弟。

1.跟着Lec 1 homework.pdf 教程走,创建功能包

cd ~/catkin_sl_ws_01/src
catkin_create_pkg fall2022 std_msgs rospy roscp
cd ~/catkin_sl_ws_01
catkin_make

2.install turtlebot2 on noetic

参考资料:https://github.com/hanruihua/Turtlebot2_on_Noetic

mkdir ~/catkin_sl_ws_01/src -p
cd ~/catkin_sl_ws_01/src
git clone https://github.com/hanruihua/Turtlebot_on_noetic.git
cd Turtlebot_on_noetic
sh turtlebot_noetic.sh

sh turtlebot_noetic.sh这一步,我失败了很多次,是网络的问题,中间有错误的话多运行几次就好了。

紧接着,回到工作空间进行编译

cd ~/catkin_sl_ws_01
catkin_make

修改~/.bashrc文件

sudo vim ~/.bashrc

在最下面一行插入如下内容,按i进入编辑模式

source ~/catkin_sl_ws_01/devel/setup.bash

按Esc :wq 保存退出

然后打开新的终端


以上是正常步骤,但本人在CMake编译这一步出现了一些错误,catkin_make,提示找不到一些包,此时,就需要本着缺什么装什么的原则补齐再编译就好了,以下为我遇到的一些问题:

-- Checking for module 'libusb' -- No package 'libusb' found

sudo apt install -y libusb-dev

继续catkin_make

-- Checking for module 'libftdi' -- No package 'libftdi' found

sudo apt install libftdi-dev

继续catkin_make,出现:

 Could not find a package configuration file provided by "Sophus" with any
  of the following names:
 
    SophusConfig.cmake
    sophus-config.cmake
 
  Add the installation prefix of "Sophus" to CMAKE_PREFIX_PATH or set
  "Sophus_DIR" to a directory containing one of the above files.  If "Sophus"
  provides a separate development package or SDK, be sure it has been
  installed.

继续装

sudo apt install ros-noetic-sophus

继续catkin_make,出现:

    image_geometryConfig.cmake
    image_geometry-Config.cmake

继续装

sudo apt install ros-noetic-image-geometry

继续catkin_make,出现:

	gazebo_rosConfig.cmake
	gazebo_ros-Config.cmake

装...

sudo apt install ros-noetic-gazebo-ros

继续catkin_make,出现:

	gazebo_pluginsConfig.cmake
	gazebo_plugins-Config.cmake

装...

sudo apt install ros-noetic-gazebo-plugins

继续catkin_make,编译到8%挂了

/bin/sh: 1:pyrcc5: not found

再装...

sudo apt install pyqt5-dev-tools

成功!


3.继续回到教程,启动Gazebo

roscd fall2022
mkdir launch
cd launch
vim gazebo.launch

把下面文件复制粘贴到gazebo.launch中,按Esc :wq 保存退出

<launch>
    <arg name="world_file" default="worlds/empty.world"/>

    <arg name="urdf" default="$(find
turtlebot_description)/robots/kobuki_hexagons_astra.urdf.xacro" />
    <param name="robot_description" command="$(find xacro)/xacro --inorder $(arg urdf)" />
    <!-- include two nodes gazebo (server) and gazebo_gui (client) -->
    <include file="$(find gazebo_ros)/launch/empty_world.launch">
        <arg name="world_name" value="$(arg world_file)"/>
    </include>

    <!-- Gazebo model spawner -->
    <node name="spawn_turtlebot_model" pkg="gazebo_ros" type="spawn_model"
          args="$(optenv ROBOT_INITIAL_POSE) -unpause -urdf -param robot_description -model mobile_base"/>

    <!-- Velocity muxer -->
    <node pkg="nodelet" type="nodelet" name="mobile_base_nodelet_manager" args="manager"/>
    <node pkg="nodelet" type="nodelet" name="cmd_vel_mux"
          args="load yocs_cmd_vel_mux/CmdVelMuxNodelet mobile_base_nodelet_manager">
        <param name="yaml_cfg_file" value="$(find turtlebot_bringup)/param/mux.yaml"/>
        <remap from="cmd_vel_mux/output" to="mobile_base/commands/velocity"/>
    </node>

    <!-- Publish robot state -->
    <node pkg="robot_state_publisher" type="robot_state_publisher"
name="robot_state_publisher">
        <param name="publish_frequency" type="double" value="30.0" />
    </node>
</launch>            

紧接着,运行launch文件就好了

roslaunch fall2022 gazebo.launch

成功!

继续,再开一个新的终端

roslaunch turtlebot_teleop keyboard_teleop.launch

这里我又报错了:

RLException: [keyboard_teleop.launch] is neither a launch file in package [turtlebot_teleop] nor is ...

如果你遇到和我一样的情况,先检查环境变量是否添加,若还是不行,删掉文件重新编译一次

cd ~/catkin_sl_ws_01
rm -rf build/ devel/
catkin_make

然后再运行


4.继续跟随教程,Set up robot arm in Gazebo.

cd ~/catkin_sl_ws_01/src
git clone https://github.com/UCR-Robotics/interbotix_ros_arms.git
cd ~/catkin_ws

下一步,采用鱼香ROS大大提供的方法

sudo pip install rosdepc
sudo rosdepc init
rosdepc update

继续

cd ~/catkin_sl_ws_01
rosdepc install --from-paths src --ignore-src -r -y

继续

sudo apt install python-pip
sudo pip install modern_robotics

继续

cd ~/catkin_ws
catkin_make

如果上面catkin_make有问题,建议重复上面删除文件再重新编译的步骤

打开一个新的终端

roslaunch interbotix_moveit interbotix_moveit.launch robot_name:=rx150 use_gazebo:=true

成功!


结语:

丢失部分命令行和截图,凭记忆复现,难免出错,望各位批评指正,多多海涵!

e-mail:[email protected]

标签:noetic,catkin,make,sudo,深蓝,第一章,ws,install,机器人学
From: https://www.cnblogs.com/ChangciWei/p/16581871.html

相关文章