How to use ROSARIA

Raspbian上的安装错误

SLAM 以及路径规划方面的知识,使用的移动机器人平台为 Pioneer 2 DX8. 使用 ROS 进行开发,首先便要安装硬件的 ROS driver,MobileRobots/ActivMedia 机器人主要有两款 driver,ROSARIA 和 p2os,我使用的是 ROSARIA.

Raspbian上的安装错误

在 Ubuntu 上可以很容易地通过这个教程安装 ROSARIA:

$ cd ~/catkin_ws/src
$ git clone https://github.com/amor-ros-pkg/rosaria.git
$ rosdep update
$ rosdep install rosaria
$ cd ~/catkin_ws
$ catkin_make

rosdep在安装的过程中发挥了重要的作用,通过rosdep,系统安装了 ROSARIA 依赖的库文件 libaria. 但是在树莓派上运行rosdep install rosaria会产生如下的错误提示:

$ rosdep install rosaria
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
rosaria: No definition of [dynamic_reconfigure] for OS [debian]

检查一下 Raspbian 软件仓库中是否有 libaria

$ apt-cache search libaria

参考链接

  1. How to use ROSARIA
  2. ARIA
  3. ARIA Installation Instructions

How to use ROSARIA

How to use ROSARIA

Install ROS

If you have not yet installed ROS, see the ROS installation instructions. The easiest OS to install ROS on is Ubuntu. Install at least the "base" set of packages.

Create your ROS workspace

If you have not yet created your ROS overlay workspace in your home directory, do so now.

Set up your shell environment, so that some ROS-specific commands are available:

. /opt/ros/kinetic/setup.bash

Create a catkin workspace. (Your workspace directory may have any name, catkin_ws is used here as an example, but you may use a different name if you wish.)

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace
cd ~/catkin_ws
catkin_make

Note that catkin_init_workspace must be run inside the src subdirectory, but catkin_make is used in the parent workspace directory. catkin_init_workspace only needs to be done once in the src directory.

You can setup separate workspaces for different versions of ROS if more than one is installed.

Source setup.bash

Every time you want to use the catkin workspace to build packages, you must source the special devel/setup.bash script:

cd catkin_ws
. devel/setup.bash

You must do this for every new shell or terminal window you open.

If you only use one catkin workspace, you can add this command to your .bashrc file, so that it automatically occurs for every new shell or terminal window you run.

For example, if your catkin workspace is catkin_ws in your home directory, edit .bashrc in your home directory and add the following line to the end of the file. The .bashrc file is normally hidden, but you can still reference it to edit it or enable "Show hidden files" in the file browser preferences.

. ~/catkin_ws/devel/setup.bash

If you have multiple catkin workspaces for multiple versions of ROS, you must source the setup file from inside the workspace you want to use.

Bring ROSARIA into the workspace

Next you will need to download the rosaria source code from its repository.

cd ~/catkin_ws/src
git clone https://github.com/amor-ros-pkg/rosaria.git

Install ARIA and Build ROSARIA

RosAria uses the Aria library from Adept MobileRobots to communicate with the robot.

To install the latest version of ARIA, download it from http://robots.mobilerobots.com/wiki/Aria. Any packages indicated for Ubuntu 12.04 and later can be used on any version of Ubuntu 12.04 or later. Install the ARIA package by opening it in the Ubuntu GUI, or use the dpkg tool on the command line with its -i option.

Note: rosaria's CMake build script detects the location of the ARIA library when catkin runs cmake. If you have already tried building rosaria prior to installing the ARIA library (either via rosdep or manually), you must force catkin to re-run cmake for rosaria with catkin_make --force-cmake. Do this if you get errors while building rosaria such as "could not find such file or directory : Aria/Aria.h" or siimlar.

Now build rosaria using catkin. Run this from your catkin workspace directory:

catkin_make 

This will build all packages in the catkin workspace.

You only need to install and build ROSARIA once, or when changing to new versions of ROSARIA or ARIA.

Run roscore

Next, we can start the RosAria node. First, run roscore from your ros workspace, if you have not done so already:

roscore

roscore must always be running for any other ROS node in this ROS node network to work and communicate. It only needs to run once, however, you don't need to run it every time you restart RosAria.

If you are running different nodes on different computers, only one roscore is needed, but its hostname (address) must be specified when running nodes on other computers. The RosAria node must run on a computer connected to the robot controller -- either the robot's (primary) onboard computer, or a laptop connected via serial connector to the robot HOST serial port.

Run the RosAria node

Next, run the !RosAria node from the rosaria package.

If necessary, open a new terminal window. If you have not yet done so in this terminal windows or shell, and you have not set up your .bashrc file to do so automatically, source the catkin setup script in your workspace:

cd catkin_ws
. devel/setup.bash

Unless the computer running RosAria has a DNS entry that client programs and other nodes can use to locate it, you must also set the ROS_IP environment variable before running RosAria. Normally ROS provides the local computer's hostname to other nodes, but if they cannot use this hostname, then they will not be able to connect to the RosAria node. The ROS_IPenvironment variable explicitly specifies the IP address to use. For example, if your computer has IP address 10.0.126.32 set ROS_IP as follows before running RosAria:

export ROS_IP=10.0.126.32

Substitute the correct IP address if different. If you are using a wireless network, use the IP address for the wireless ethernet interface (usually wlan0wifi0, or ath0).

Next, run the RosAria node:

rosrun rosaria RosAria

The first argument to rosrun specifies the package name, "rosaria". The second argument to rosrun specifies the node name, "RosAria".

Additional parameters may be set via rosrun. See below for details.

If you receive an error regarding connecting to the robot on port /dev/ttyUSB0 or similar, you may need to specify a different port via the ~port parameter. See the section below on "RosAria Parameters" for more information.

To disconnect, then reconnect with the robot, kill RosAria (by pressing Ctrl-C or using the kill command) and re-run it.

Only one program can connect to the robot at a time, so only one instance of the rosaria node (or any other program connected to the robot, such as one of the demo/example/server programs provided with ARIA or ARNL, or the p2os node) can run at a time.

Note, if you ran roscore on a different computer, set the ROS_MASTER_URI environment variable first to reference thatroscore server. For example, if you ran roscore on a computer with address 10.0.100.1, set it like this:

export ROS_MASTER_URI=http://10.0.100.1:11311

You must also set ROS_MASTER_URI before running any other nodes or client programs on computers other than the computer running roscore.

RosAria Parameters

RosAria has a port parameter that specifies which serial port to use to connect to the robot, or it may contain a hostname and TCP port to connect remotely over TCP (for example, to connect to an AmigoBot or other robot that uses a wifi serial-bridge or to to a MobileSim simulator running on a different host.) The port parameter may be given on the command line when running the RosAria node with rosrun, or it may be changed using rosparam (before staring RosAria, or restart RosAria.) The value will be saved in the ROS parameters and reused next time you run RosAria.

The default port is /dev/ttyUSB0, which will work if you have connected your Linux laptop or other computer to the robot via a USB-serial adapter, and also on the Pioneer LX which uses USB-serial adapters:

rosrun rosaria RosAria

To specify the port as /dev/ttyS0 (COM1, normal for most robot onboard computers) instead, use:

rosrun rosaria RosAria _port:=/dev/ttyS0

Make sure you have added your user to the "dialout" group (sudo usermod -a -G dialout $USER), or change the permissions of the serial port device to allow all users to access it (e.g. sudo chmod a+rw /dev/ttyUSB0 orsudo chmod a+rw /dev/ttyS0). You can check the Linux kernel logs by running dmesg after plugging in the USB-serial converter to see the name of the device interface being used.

If you have a robot with a wireless ethernet-serial bridge device with IP address 10.0.126.32, use the following command instead:

rosrun rosaria RosAria _port:=10.0.126.32:8101

If using the onboard computer on a Pioneer 3, Pioneer 2, PeopleBotPowerBot or PatrolBot, use /dev/ttyS0 as in the example above. IF you are using the embedded computer in a Pioneer LX, use /dev/ttyUSB0.

Note that only one instance of the RosAria node may run at one time, stop any other RosAria instances before running a new one.

In addition to the port parameter, RosAria also accepts other parameters as well. See ROSARIA for a full list.

Note: When you specify a parameter using rosrun, the ROS parameter system automatically stores this setting for future use, and will use the previously set value if the parameter is omitted. Specify a new value to change.

Example Client Programs

An example set of client programs with a text-based interactive interface for running them is available from https://github.com/pengtang/rosaria_client. Read the README file for instructions. These example programs show how to publish or subscribe to ROSARIA's topics, and can be used to interactively test or demonstrate ROSARIA controlling the robot.

Launch files and other configuration

A set of configuration files including roslaunch files, URDF, etc is available from http://github.com/MobileRobots/amr-ros-config

Using MobileSim simulator

MobileSim is a simulator for use with ARIA. It provides a simple 2D simulation scalable to many robots, and useful for software testing. (It is actually based on Stage version 2.)

ARIA automatically detects MobileSim if it is running on the same computer, and will connect to it. Or, you can explicitly set it using RosAria's ~port parameter:

rosrun rosaria RosAria _port:=localhost:8101

MobileSim will emulate the robot base (i.e. velocity commands from the cmd_vel topic and a position estimate given via poseor odom topics -- see below) and sonar (sonar topic -- see below), but connection to other devices such as laser, camera, etc. are through separate nodes in ROS and cannot currently be connected to MobileSim.

For more full-featured simulation in ROS, use stdr_simulatorStage or Gazebo instead.

Topics and Commands

RosAria provides several topics for publishing information received from the robot and devices by ARIA, and for receiving commands. These follow ROS conventions and use standard ROS datatypes and units. For example, it uses a "twist" for velocity commands, even though only some components apply to differential drive ground mobile robots, and units are translated to meters and radians as used in ROS from the millimeters and degrees used by the robot and ARIA.

Pose

RosAria publishes the current pose estimation received from the robot in /RosAria/pose. The type of this data isnav_msgs/Odometry. (This pose estimation is calculated by the robot firmware as ARIA based on wheel odometry, and if preset, the optional internal gyroscope.)

This pose estimation is received from the robot every 100ms (by default), and is then published on the /RosAria/posetopic.

To view /RosAria/pose using rostopic use:

rostopic echo /RosAria/pose

Press Ctrl-C to stop.

Velocity Commands

The desired velocity of the robot is set via the /RosAria/cmd_vel topic. This desired velocity state is set in ARIA, which sends commands every robot cycle (100ms by default) to effect this state in the robot's embedded motion controller, which performs motor control to achieve then maintain the robot velocity automatically (using previously configured acceleration parameters).

You do not need to send commands at any fixed rate to maintain robot velocity, ARIA and the robot controller maintain the velocities. Velocity commands only need to be sent to change the desired velocities.

A standard type for robot motion commands in ROS is geometry_msgs/Twist, which contains many components (dimensions). The relevant twist components for Pioneer mobile robots are linear x (forward/back translational velocity) and angular z (rotational velocity). (In future, the Seekur robot will accept linear y for lateral velocity as well.)

The syntax for specifying twist data using the rostopic command is as follows (this example sets a linear velocity of 0.1 meters/s):

rostopic pub -1 /RosAria/cmd_vel geometry_msgs/Twist '[0.1, 0.0, 0.0]' '[0.0, 0.0, 0.0]'

Sonar

RosAria also provides the /RosAria/sonar topic for sonar readings. The type of this topic is a 2-dimensionalsensor_msgs/PointCloud.

Bumpers

RosAria also provides /RosAria/bumper_state for bumper switch state:

BumperState contains two boolean arrays, front_bumpers and rear_bumpers)

Battery State

RosAria publishes a /RosAria/battery_state_of_charge topic for robot models which provide battery state-of-charge data (Pioneer LX, Seekur, Seekur Jr.). This is a charge percentage from 0.0 to 1.0. If a robot does not provide state-of-charge data, then this topic is not published.

RosAria publishes /RosAria/battery_voltage topic for all robot models. This is a battery voltage measurement (volts DC).

Recharging Status

RosAria can provide status on recharging a Pioneer LX robot, via the /RosAria/battery_recharge_state topic.

This is an 8-bit integer which is 0 if not charging, > 0 if recharging, and < 0 on error or no data. (Specifically -2 means no data; -1 unknown state; 0 not recharging; 1 bolk recharge; 2 overcharge state; 3 float)

If a robot does not provide recharge status, then this topic is not published.

Enable/Disable Motors

Whether the robot's motors are enabled or disabled is published as a boolean value via the /RosAria/motors_state topic.

To enable the motors, use the /RosAria/enable_motors service. To disable the motors, use the /RosAria/disable_motorsservice.

RosAria enables the motors when it connects to the robot, but some robots require motors to be explicitly re-enabled after the e-stop button is pressed (e.g. Pioneer LX) or a bumper hit occurs (e.g. Seekur).

Laser Rangefinders

You can optionally configure RosAria to connect to any laser rangefinder sensors configured in the ARIA robot parameters, and provide that data as well as robot data. Set the ~publish_aria_lasers parameter to true on the command line with rosrun or in your roslaunch file. For example: rosrun rosaria RosAria _publish_aria_lasers:=true.

Or, you may run a ROS node specific to your laser type. These nodes will be configurable through ROS parameters and may provide more ROS-specific data. See Robots/Pioneer for more discussion of lasers, including notes specific to the LMS-200 and Pioneer 3 robot, and for links to documentation on various ROS nodes supporting various laser rangefinder types.

Note that you will need to disable ~publish_aria_lasers if you have previously run RosAria with ~publish_aria_lasers set to true. For example: rosrun rosaria RosAria _publish_aria_lasers:=false.

Other Topics

Other topics may be added in the future as well.

See ROSARIA for the current, complete list.

Acceleration Parameters

Acceleration and deceleration parameters may be adjusted via dynamic_reconfigure: trans_acceltrans_decel,rot_accelrot_decellat_accellat_decel. These are sent to the robot controller and it will use them as soon as any requested velocity changes to achieve that change in velocity.

Odometry Calibration

It is possible to modify odometry/position integration parameters (TicksMMDriftFactorRevCount) via dynamic_reconfigure. These parameters will be stored and re-set whenever the RosAria node runs.

If these parameters are not set, then the robot controller will use its saved values, usually these are default values for that model robot, but can be changed using the robot controller firmware configuration tool. Defaults often work fine for most robots, but you can tweak the calibration if you want to try to improve it slightly to adjust for worn tires or other differences in your individual robot.

If these calibration parameters are set and RosAria is changing them at startup, then RosAria will print a log message indicating that it is using these parameters and sending them to the robot.

Useful utilities and companion nodes

For a list of nodes used with some common accessory devices used on Pioneer robots, seeRobots/AMR_Pioneer_Compatible#Hardware_Drivers_and_Simulation.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值