Skip to content
Kegan Kawamura edited this page Mar 21, 2017 · 6 revisions

ROS

As explained in Home, an open-source library and set of tools for programming robots. The advantage of ROS is its use of nodes and topics, which allows programs as separate modules, allowing ease for running programs in parallel. This wiki will not include a tutorial on ROS, but there are many useful resources available.

Instead, this wiki will focus on ROS commands/tools that are useful or relevant to BARC, and how to use them with the system.

ROS commands

Below is a list of some commonly used commands. Check this link for a comprehensive list

  • Change to a ROS package directory
    • roscd <package_name>, for example roscd barc
  • Run a single ROS node
    • roscore (in one terminal)
    • rosrun <package> <file_name> (in another terminal)
  • Run a launch file
    • roslaunch <package> <file_name>.launch
  • Display the active topics
    • rostopic list
  • Print the messages coming from a topic
    • rostopic echo <topic>
  • Print the publishing rate of a topic
    • rostopic hz <topic>

ROS Workspace

A quick summary of the folders or 'spaces' taken from ROS wiki

The source (src) space contains the source code of ROS packages.

The build space is where CMake is invoked to build the packages in the source space

The development (devel) space is where built targets are placed prior to being installed.

In general, users work only within the src folder.

Packages

Software in ROS is organized in packages. A few of the packages included in ~/barc/workspace

  • barc
    • barc is the main package for autonomous driving with the RC vehicle. This packages includes example controllers, model-based observers, and other utility modules (e.g. filtering, imu driver, etc.) to control the vehicle.
  • barc_gui
    • barc_gui is a package for a cloud service pluggin using the ROS rqt gui. During experiments, the user can select which actuator/sensor messages (i.e. motor, encoder, imu, ultrasound, etc.) to record to bagfiles. After the experiment finishes, the data inside the bagfile is parsed, formatted, and pushed to the cloud. To view the data, go to this site
  • data_service
    • data_service is a package for the cloud service functionality. It handles the communication details (authentication, POST/GET requests, etc.) between the client (odroid) and the server.
  • rqt_common_plugins
    • rqt_common_plugins is a sub-package for the ROS rqt package, which allows users to drag and drop userful pluggins into a QT-based graphical user interface. This package is forked from the main rqt_common_plugins package, ROS package wiki here. This forked version fixes some bugs with the main package

View installed packages

To check which packages are already install on your machine, do

rospack list-names

Installing new packages

To add a package, use one of the following to methods

  1. Use apt-get utility
    • sudo apt-get install ros-indigo-<package_name>
    • Downloads and installs the package on your system, usually inside /opt/ros/indigo. You should not edit these files
  2. Clone package from github repository. From this directory, execute the following command
    • git clone <git_ROS_package_URL>.git
    • Downloads and saves a copy of the package to the folder where the command was called. This is safe to edit

For example, to install the high performance AHRS(Attitude Heading Reference System) imu drivers from Hardkernel, do one of the following

  • sudo apt-get install ros-indigo-myahrs-driver, or
  • git clone https://github.com/robotpilot/myahrs_driver.git

Afterward, go back to the ~/barc/workspace folder and run catkin_make to rebuild the workspace packages

Register with the cloud

In your home directory, edit a file named team_name.sh to define a user name, then in four separate terminals, execute the following

source ~/barc/scripts/reset_database.sh
roscore
rosrun data_service service.py
source ~/barc/scripts/register_cloud.sh

To run an experiment, enter the following three commands in three separate terminals. This should launch a single gui window with four different pluggins. (Note, experiments launched via the command line using roslaunch barc <file_name>.launch may save data to bagfiles, but the data will not be pushed to the cloud)

roscore
rosrun data_service service.py
rqt -p ~/barc/perspectives/experiment.perspective

When the odroid connects to the Internet through a wifi network, all data collected will be automatically pushed to the cloud, where the data will be publicly accessible. To view the data, go to this site and search for your user name.