ROS handbook

Start ROS

Network Setup - Single Machine Configuration

If you just want to run tests on your local machine, set these environment variables:

$ export ROS_HOSTNAME=localhost
$ export ROS_MASTER_URI=http://localhost:11311

Another way to set ROS_HOSTNAME is to use .local domain

$ export ROS_HOSTNAME=ubuntu.local
$ export ROS_MASTER_URI=http://ubuntu.local:11311

Sometimes, system is unable to resolve to .local domain. When you encounter such issue, apart from following diagnostics mentioned above, check whether your avahi service is running.

$  systemctl is-active avahi-daemon.service

If required, you can restart avahi service as follows:

$  systemctl restart avahi-daemon.service

Basic Structure

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-34ItWRFt-1579395944019)(./assets/StructureOfROSProject.png)]

Create and build a catkin workspace

$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/
$ catkin_make
$ . ~/catkin_ws/devel/setup.bash
#To add the workspace to your ROS environment you need to source the generated setup file

Before continuing source new setup.*sh file:

$ source devel/setup.bash
#或者直接把它加入到环境变量里,这样每次开终端都会加载
$ echo "source devel/setup.bash " >> ~/.bashrc

To make sure your workspace is properly overlayed by the setup script, make sure ROS_PACKAGE_PATH environment variable includes the directory you’re in.

$ echo $ROS_PACKAGE_PATH /home/youruser/catkin_ws/src:/opt/ros/melodic/share

ROS Filesystem

$ rospack find [package_name]
# return the path to package
$ rospack list 
# show all packages
$ rospack depends1 beginner_tutorials 
# These first-order dependencies can now be reviewed with the rospack tool
$ rospack depends1 rospy
# show dependencyrospy's other dependencies

$ roscd [locationname[/subdir]]
# just llike 'cd' command

$ rosls [locationname[/subdir
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值