ROS_Kinetic_04 ROS基础内容(一)

本文档详细介绍了ROS_Kinetic版本的基础设置流程,包括环境变量配置、工作空间创建、文件系统导航及功能包的创建与编译。适用于ROS初学者。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

ROS_Kinetic_04 ROS基础内容(一)

在开始基础内容之前,假定您已经完成了ROS kinetic版本的安装,

如果没有请参考ROS kinetic安装说明


1. 环境变量

在使用ROS期间,一定要确保环境变量配置正确,通常是source不同的setup.bash。

~$ source /opt/ros/kinetic/setup.bash

如果您在查找和使用ROS功能表遇到问题,请检查您的脚本环境,可以使用以下命令:

~$ export | grep ROS


为了避免在每次启动终端都输入ROS相关环境配置命令,可以将其添加到.bashrc文件中。


2. 创建ROS工作空间(catkin)

输入下面命令创建一个新的catkin工作空间:

~$ mkdir -p ~/catkin_ws/src

~$ cd catkin_ws/

~/catkin_ws$ catkin_make

完成后,输入下面命令:

~/catkin_ws$ source devel/setup.bash

使用下面命令查看环境变量:

~/catkin_ws$ echo $ROS_PACKAGE_PATH

为了避免在每次启动终端都需要配置环境变量,修改.bashrc:


3. ROS文件系统

首先确保教程包已经安装:

~$ sudo apt-get install ros-kinetic-ros-tutorials

Packages:功能包-包含程序,可执行文件,脚本等;

Manifest:清单-包含依赖关系,版本信息等。

文件系统工具:

使用rospack获取功能包的相关信息。

~$ rospack find turtlesim

使用roscd直接前进到功能包目录中:

~$ roscd turtlesim

$ pwd

rosls

~$ rosls turtlesim

Tab补全小技巧。----rospack roscd rosls----


4. 创建ROS功能包

先提供官网中文教程:http://wiki.ros.org/cn/ROS/Tutorials/CreatingPackage

列一些重要的命令:

~$ cd catkin_ws/src/

~/catkin_ws/src$ catkin_create_pkg hello_kinetic std_msgs rospy roscpp

依赖关系:

~/catkin_ws/src$ rospack depends hello_kinetic

~/catkin_ws/src$ rospack depends1 hello_kinetic


5. 编译ROS功能包

先提供官网中文教程:http://wiki.ros.org/cn/ROS/Tutorials/BuildingPackages

~/catkin_ws$ catkin_make

~/catkin_ws$ catkin_make install

如果源代码不再src文件夹使用下面命令:

~/catkin_ws$ catkin_make --source xxxx

当功能包编译完成,就可以使用了。

这里以usb_cam为例,下载地址:https://github.com/bosch-ros-pkg/usb_cam

~/catkin_ws$ catkin_make

~/catkin_ws$ rosstack profile & rospack profile


~/catkin_ws$ roslaunch usb_cam usb_cam-test.launch

-End-


### ROS Kinetic Calibration Tutorial and Resources For users interested in calibrating sensors or other components within the ROS Kinetic environment, several tutorials and resources are available. The `pluginlib` package provides an abstract framework for creating and using plugins which might be useful when developing custom calibration nodes[^1]. However, specific to calibration tasks, one of the most comprehensive guides comes from the official ROS wiki documentation. The Camera Calibration tool is part of the image_pipeline suite and allows performing camera intrinsic parameter estimation through a graphical user interface. This process involves capturing images containing a known pattern such as a chessboard grid placed at different orientations relative to the camera lens. After collecting enough samples, running the calibration node will compute focal length, principal point position, distortion coefficients among others parameters necessary for undistorting captured frames during operation. Another important aspect covered by these materials includes extrinsic parameters determination between multiple cameras mounted on robots like TurtleBot where accurate alignment ensures better performance especially while navigating environments based upon visual SLAM algorithms. Instructions provided explain not only theoretical concepts behind each step involved but also practical considerations regarding setup preparation before starting actual measurements. Moreover, integrating self-created maps alongside simulation platforms enhances testing capabilities without requiring physical hardware availability all times thus facilitating development cycles significantly according to explanations found elsewhere concerning Stage integration techniques specifically tailored towards mobile bases equipped with laser scanners capable of generating occupancy grids used later inside Gazebo worlds after proper adjustments made via configuration files following guidelines outlined thereupon too[^3]. Lastly, expanding workspaces beyond base installations enables incorporating specialized libraries supporting advanced functionalities required throughout various stages ranging from data acquisition up until post-processing analysis phases thanks largely due contributions coming directly out-of-the-box once extra dependencies get added properly following instructions laid down hereunder about managing releases efficiently so projects benefit fully from community efforts put forth collectively over time ensuring compatibility across diverse setups encountered regularly nowadays within research labs around globe alike[^5]. ```bash roslaunch camera_calibration cameracalibrator.launch \ image:=<your_image_topic> \ camera_name:=<your_camera_name> \ calib_url:=<path_to_your_calib_file> ```
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

zhangrelay

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值