Skip to content

jeshoward/beginner_tutorials

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ENPM808X - ROS TF, Unit Testing, and Bag Files

This is the continuation of the implementation of several ROS beginner tutorials:

  1. Creating a Workspace for Catkin
  2. Creating a ROS Package
  3. Building a ROS Package
  4. Creating a ROS msg and srv
  5. Writing a Simple Publisher and Subscriber (C++)

The original goal of the project was to install ROS and Catkin, create a workspace, and create a simple publisher and subscriber package. This branch (Week10_HW) continues the effort by applying lessons learned in the following intermediate ROS tutorials:

  1. Getting started with roswtf
  2. Understanding ROS Services and Parameters
  3. Using rqt_console and roslaunch

Additional services added to the beginner tutorials are: Add Two Ints

The Add Two Ints service was implemented as per the tutorial Writing a Simple Service and Client.

The third follow on assignment involved modifying the Talker node to broadcast a tf frame called /talk with parent /world. It also added a Level 2 integration test. The launch file now supports recording using rosbag. The following tutorials were used:

  1. Writing rostest files
  2. gtest
  3. Recording and playing back data
  4. Introduction to tf
  5. Writing a tf broadcaster (C++)
  6. Writing a tf listener (C++)
  7. Adding a frame (C++)
  8. Learning about tf and time (C++)
  9. Time travel with tf (C++)

Getting Started

Installing Dependencies

The beginner tutorial has several dependencies including ROS Kinetic Kame and Catkin.

Installing ROS Kinetic Kame

Full instructions for installing ROS Kinetic Kame can be found here.

The following instructions are for an Ubuntu installation.

  1. Set up your sources.list
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
  1. Set up your keys
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
  1. Installation Make sure your Debian package is up to date:
sudo apt-get update

Perform a full desktop install:

sudo-apt-get install ros-kinetic-desktop-full
  1. Initialize rosdep
sudo rosdep init
rosdep update
  1. Environment set up
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
  1. Install rosinstall
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential

Installing Catkin

Full instructions for installing Catkin can be found here.

sudo apt-get install ros-lunar-catkin

Installing rqt_tf_tree

rqt_tf_tree is a runtime tool for visualizing the tree of frames that are being broadcast over ROS. To install:

sudo apt-get install ros-kinetic-rqt-tf-tree

To use:

rosrun rqt_tf_tree rqt_tf_tree

Installing the beginner tutorial from this repository

You will want to navigate to your Catkin workspace's src directory

cd ~/catkin_ws/src

This is the location you will want to add your new ROS package.

git clone -b Week10_HW https://github.com/jeshoward/beginner_tutorials

Navigate back up to your Catkin workspace directory:

cd ~/catkin_ws/

Next, you will want to build the project:

catkin_make

Running the project

The steps for testing your new ROS package can be found in the ROS tutorial Examining the Simple Publisher and Subscriber.

Make sure that your roscore is up and running

roscore

Running roscore will tie up your terminal window, so you'll need to open a new terminal window.

In the new terminal window, since we are using Catkin, we'll want to make sure that we've sourced our workspace's setup.sh file:

cd ~/catkin_ws/
source ./devel/setup.bash

Next we will start our launcher, which begins the talker and listener:

roslaunch beginner_tutorials week11_hw.launch

Recording to a rosbag

The launch file now supports bagfile recording. Recording is by default disabled, to enable it for 15 seconds use the following command during launch:

roslaunch beginner_tutorials week11_hw.launch record_bag:=true

Playing a rosbag

To play the bag you've just recorded, enter the following:

rosbag play <rosbag_file_name>

To merely inspect the rosbag to find out information about what topics and types it recorded:

rosbag info <rosbag_file_name>

Rosbag demo

An easy demo to show the functionality of rosbag play and record is to run the listener only, then in a separate window run rosbag record.

First terminal window:

rosrun beinner_tutorials listener

Second terminal window:

rosbag record --duration=5 /Week11_HW/chatter

To inspect the bagfile you've just recorded:

rosbag info <rosbag_file_name>

Add Two Ints

Add two ints takes two integer arguments, a and b, and adds them together.

rosrun beginner_tutorials add_two_ints_client a b

You can also input the arguments for a and b from the launcher by using the following code:

roslaunch beginner_tutorials week10_hw.launch a:=1 b:=2

When you are done, press Ctrl-C to terminate the servers.

Testing the project

The tests for this tutorial are run under gtest. To run the unit tests navigate to your ~/catkin_ws/ directory and type:

catkin_make run_tests

License

BSD 3-Clause License

Copyright (c) 2017, Jessica Howard All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

About

ENPM808X ROS Beginner tutorials assignment

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published