ROS机器人编程:原理与应用(A Systematic Approach to Learning Robot Programming with ROS 中文译版)

Posted zhangrelay

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ROS机器人编程:原理与应用(A Systematic Approach to Learning Robot Programming with ROS 中文译版)相关的知识,希望对你有一定的参考价值。

ROS机器人编程:原理与应用 

(A Systematic Approach to Learning Robot Programming with ROS)

英文原版书下载链接:https://share.weiyun.com/5SVHCXS

推荐中英文对照同步学习!

更新现在此课程已经支持noetic,melodic,kinetic,indigo

noetic:github.com/wsnewman/learning_ros_external_pkgs_noetic

其余:github.com/wsnewman/learning_ros_setup_scripts


 


本书配套云端自主学习平台-实验楼-(环境全部配置完成,即开即用):

https://blog.csdn.net/ZhangRelay/article/details/88530278

不少实验楼用户反馈我制作的课程质量差,接受批评,深刻反思。

由于云端和虚拟机体验较差,推荐安装电脑ROS学习使用,实验楼课程暂停更新。

本书对于代码的讲解详细具体,个人大爱,以下是译者序:

《ROS机器人编程:原理与应用》译者序

本书完全适用于使用indigo或kinetic的学习者或开发者,部分适用Melodic。

Ubuntu 14.04 和 ROS Indigo:

  1. 学习源码:https://github.com/wsnewman/learning_ros
  2. 扩展资源:https://github.com/wsnewman/learning_ros_external_packages

Ubuntu 16.04 和 ROS Kinetic:

  1. 学习源码:https://github.com/wsnewman/learning_ros_kinetic
  2. 扩展资源:https://github.com/wsnewman/learning_ros_external_pkgs_kinetic

本书设置脚本

这里的脚本假设您在github上有一个帐户(在github.com上是免费的)。

您需要在计算机上安装“git”才能使用这些脚本。如果您的计算机上尚未安装“git”,则可以安装: 

sudo apt-get --yes --force-yes install git


获取脚本并使其可执行

要运行这些脚本,请在任何目录中键入以下内容,在计算机上的任何位置克隆learning_ros_setup_scripts: 

git clone https://github.com/wsnewman/learning_ros_setup_scripts.git

获得文件后,learning_ros_setup_scripts键入以下命令更改目录: 

cd learning_ros_setup_scripts

在此之后,键入以下命令使脚本可执行: 

chmod +x *.sh

ROS设置

要使用“学习ROS”设置所有依赖项和程序的Indigo的ROS安装,请install_ros_and_tools.sh键入以下命令运行脚本:

(./install_ros_and_tools.sh 或bash install_ros_and_tools.sh

对于ROS Kinetic使用此行:(与Ubuntu 16.04一起使用) 

./install_ros_and_tools_kinetic.sh

工作站设置

要为ROS Indigo设置ROS工作区,请使用该setup_workspace_learning_ros.sh脚本。您需要将您的github用户名和电子邮件作为参数传递给脚本:

./setup_workspace_learning_ros.sh github_username github@email.com 

bash setup_workspace_learning_ros.sh github_username github@email.com

其中github_username是您在github上的用户名,github @ email.com是您与github帐户关联的电子邮件地址。

对于ROS Kinetic,请使用以下行: 

./setup_workspace_learning_ros_kinetic.sh github_username github@email.com


Kinetic install zsh

 

#!/bin/zsh
# ROS
# ROS + Dependencies Installation
# v 0.36

echo "Beginning ROS Installation"

echo -e "\\e[1m \\e[34m >>> Beginning ROS Kinetic Installation \\e[21m \\e[39m"
echo -e "\\e[34m >>> Setting up sources.list and keys... \\e[39m"

  sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
  sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key 0xB01FA116
  sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
echo -e "\\e[34m >>> ...done\\e[39m"

  sudo apt-get update

echo -e "\\e[34m >>> Beginning ros-kinetic-desktop-full installation...\\e[39m"

  sudo apt-get --yes --allow install ros-kinetic-desktop-full 

echo -e "\\e[34m >>> Setting up rosdep\\e[39m"

  sudo rosdep init
  rosdep update

echo -e "\\e[34m >>> Setting up environment \\e[39m"

  echo "source /opt/ros/kinetic/setup.zsh" >> ~/.zshrc
  source ~/.zshrc

echo -e "\\e[34m >>> Setting up rosinstall \\e[39m"

  sudo apt-get --yes --force-yes install python-rosinstall

echo -e "\\e[1m \\e[34m >>> Installing dependencies for mobile robotics code \\e[21m \\e[39m"

sudo apt-get --yes --force-yes install ros-kinetic-joy ros-kinetic-costmap-2d ros-kinetic-nav-core ros-kinetic-sound-play ros-kinetic-amcl ros-kinetic-slam-gmapping ros-kinetic-move-base ros-kinetic-controller-interface ros-kinetic-gazebo-ros-control ros-kinetic-joint-state-controller ros-kinetic-effort-controllers ros-kinetic-moveit-msgs ros-kinetic-stdr-simulator ros-kinetic-teleop-twist-keyboard ros-kinetic-slam-gmapping ros-kinetic-map-server ros-kinetic-qt-build ros-kinetic-kdl-parser ros-kinetic-combined-robot-hw ros-kinetic-combined-robot-hw-tests ros-kinetic-controller-manager-tests ros-kinetic-diff-drive-controller ros-kinetic-force-torque-sensor-controller ros-kinetic-gripper-action-controller ros-kinetic-imu-sensor-controller ros-kinetic-position-controllers ros-kinetic-ros-control ros-kinetic-ros-controllers ros-kinetic-rqt-joint-trajectory-controller ros-kinetic-velocity-controllers
sudo apt-get --yes --force-yes install ros-kinetic-cv-bridge ros-kinetic-polled-camera ros-kinetic-camera-info-manager ros-kinetic-tf-conversions
sudo apt-get --yes --force-yes install ros-kinetic-opencv3 libopencv-dev

sudo apt-get --yes --force-yes install ros-kinetic-ur-description ros-kinetic-ur-gazebo
  
echo -e "\\e[1m \\e[34m >>> Installing support software \\e[21m \\e[39m"

  sudo apt-get --yes --force-yes install git
  sudo add-apt-repository -y ppa:webupd8team/sublime-text-3
  sudo apt-get update
  sudo apt-get --yes --force-yes install sublime-text-installer 

  sudo apt-get --yes --echo -e "\\e[34m >>> Setting up rosinstall \\e[39m"

  sudo apt-get --yes --force-yes install python-rosinstall install netbeans
  sudo apt-get --yes --force-yes install gitk git-gui
  sudo apt-get --yes --force-yes install kazam vlc
  
  
echo -e "\\e[1m \\e[34m >>> Installing rqt \\e[21m \\e[39m"
  sudo apt-get --yes install ros-kinetic-rqt
  sudo apt-get --yes install ros-kinetic-rqt-common-plugins

  source ~/.zshrc

source ~/ros_ws/devel/setup.zsh





Kinetic setup zsh

#!/bin/zsh
# ROS - Workspace setup script
# v 0.26
# Wyatt Newman and Luc Bettaieb

echo "Setting up workspace."

USERNAME=$1
EMAIL=$2

if [ "$USERNAME" != "" ] || [ "$EMAIL" != "" ];
then
  source /opt/ros/kinetic/setup.zsh
  echo "source /opt/ros/kinetic/setup.zsh" >> ~/.zshrc
  rosdep update

  mkdir -p ~/ros_ws/src
	
  cd ~/ros_ws/src  && catkin_init_workspace
  cd ~/ros_ws && catkin_make

  git config --global user.name "$USERNAME"
  git config --global user.email "$EMAIL"
#https://github.com/wsnewman/learning_ros_kinetic.git
#https://github.com/wsnewman/learning_ros_external_packages_kinetic.git
  cd ~/ros_ws/src && git clone https://github.com/wsnewman/learning_ros_kinetic.git
  cd ~/ros_ws/src && git clone https://github.com/wsnewman/learning_ros_external_pkgs_kinetic.git
  
  # Cloning STDR is only necessary because of a bug in the current ROS binary release
  # This prevents spawning a new robot on the screen. See this bug report for more information:
  # https://github.com/stdr-simulator-ros-pkg/stdr_simulator/issues/195

  # cd ~/ros_ws/src && git clone https://github.com/stdr-simulator-ros-pkg/stdr_simulator.git

  echo "source ~/ros_ws/devel/setup.zsh" >> ~/.zshrc
  source ~/.zshrc

  cd ~/ros_ws && catkin_make
  cd ~/ros_ws && catkin_make install


  echo "alias cs_create_pkg='~/ros_ws/src/learning_ros_external_pkgs_kinetic/cs_create_pkg.py'" >> ~/.zshrc
  echo "source ~/ros_ws/devel/setup.zsh" >> ~/.zshrc
  echo "export ROS_WORKSPACE='$HOME/ros_ws'" >> ~/.zshrc
  # echo "export ROS_IP=`ifconfig eth0 2>/dev/null|awk '/inet addr:/ print $2'|sed 's/addr://'`" >> ~/.zshrc



else
  echo "USAGE: ./setup_workspace_learning_ros your_github_username your_email@email.com"

fi

echo "[!!!] NB: You must still manually add your ROS_IP to your ~/.zshrc.  Do this by checking your IP with hostname -I or ifconfig and then adding export ROS_IP='x.x.x.x' to your ~/.zshrc."

 



Kinetic bash

#!/bin/bash
# Learning ROS
# ROS + Dependencies Installation
# v 0.36

echo "Beginning ROS Installation"

echo -e "\\e[1m \\e[34m >>> Beginning ROS Kinetic Installation \\e[21m \\e[39m"
echo -e "\\e[34m >>> Setting up sources.list and keys... \\e[39m"

  sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
  sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key 0xB01FA116

echo -e "\\e[34m >>> ...done\\e[39m"

  sudo apt-get update

echo -e "\\e[34m >>> Beginning ros-kinetic-desktop-full installation...\\e[39m"

  sudo apt-get --yes --allow install ros-kinetic-desktop-full 

echo -e "\\e[34m >>> Setting up rosdep\\e[39m"

  sudo rosdep init
  rosdep update

echo -e "\\e[34m >>> Setting up environment \\e[39m"

  echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
  source ~/.bashrc

echo -e "\\e[34m >>> Setting up rosinstall \\e[39m"

  sudo apt-get --yes --force-yes install python-rosinstall

echo -e "\\e[1m \\e[34m >>> Installing dependencies for mobile robotics code \\e[21m \\e[39m"

sudo apt-get --yes --force-yes install ros-kinetic-joy ros-kinetic-costmap-2d ros-kinetic-nav-core ros-kinetic-sound-play ros-kinetic-amcl ros-kinetic-slam-gmapping ros-kinetic-move-base ros-kinetic-controller-interface ros-kinetic-gazebo-ros-control ros-kinetic-joint-state-controller ros-kinetic-effort-controllers ros-kinetic-moveit-msgs ros-kinetic-stdr-simulator ros-kinetic-teleop-twist-keyboard ros-kinetic-slam-gmapping ros-kinetic-map-server ros-kinetic-qt-build ros-kinetic-kdl-parser ros-kinetic-combined-robot-hw ros-kinetic-combined-robot-hw-tests ros-kinetic-controller-manager-tests ros-kinetic-diff-drive-controller ros-kinetic-force-torque-sensor-controller ros-kinetic-gripper-action-controller ros-kinetic-imu-sensor-controller ros-kinetic-position-controllers ros-kinetic-ros-control ros-kinetic-ros-controllers ros-kinetic-rqt-joint-trajectory-controller ros-kinetic-velocity-controllers
sudo apt-get --yes --force-yes install ros-kinetic-cv-bridge ros-kinetic-polled-camera ros-kinetic-camera-info-manager ros-kinetic-tf-conversions
sudo apt-get --yes --force-yes install ros-kinetic-opencv3 libopencv-dev

sudo apt-get --yes --force-yes install ros-kinetic-ur-description ros-kinetic-ur-gazebo
  
echo -e "\\e[1m \\e[34m >>> Installing support software \\e[21m \\e[39m"

  sudo apt-get --yes --force-yes install git
  sudo add-apt-repository -y ppa:webupd8team/sublime-text-3
  sudo apt-get update
  sudo apt-get --yes --force-yes install sublime-text-installer 

  sudo apt-get --yes --echo -e "\\e[34m >>> Setting up rosinstall \\e[39m"

  sudo apt-get --yes --force-yes install python-rosinstall install netbeans
  sudo apt-get --yes --force-yes install gitk git-gui
  sudo apt-get --yes --force-yes install kazam vlc
  
  
echo -e "\\e[1m \\e[34m >>> Installing rqt \\e[21m \\e[39m"
  sudo apt-get --yes install ros-kinetic-rqt
  sudo apt-get --yes install ros-kinetic-rqt-common-plugins

  source ~/.bashrc

source ~/ros_ws/devel/setup.bash

更多详细资料和教程,稍后补充


 

以上是关于ROS机器人编程:原理与应用(A Systematic Approach to Learning Robot Programming with ROS 中文译版)的主要内容,如果未能解决你的问题,请参考以下文章

机器人编程实践-ROS2基础与应用-第⑦版

编写第一个ROS程序-发布器(Publisher)

为什么选择ROS2编程作为机器人工程课程之一?

ROS从入门到精通 TF坐标变换原理,为什么需要TF变换?

ROS多机器人控制(主从机配置)与launch递归启动

ROS2机器人编程简述新书推荐-A Concise Introduction to Robot Programming with ROS2