CS148 Assignment Enclosure Escape

From Brown University Robotics
(Difference between revisions)
Jump to: navigation, search
m (Run ROS and teleoperate the robot)
(ROS for Robot Control)
 
(46 intermediate revisions not shown)
Line 1: Line 1:
 +
<skin>modern</skin>
==Introduction==
==Introduction==
Line 9: Line 10:
==Important Dates==
==Important Dates==
-
Assigned: Sept XX, 2010
+
Project Assigned: Sept 3, 2010
-
Due: Sept XX, 2010
+
Project Due: Sept 17, 2010, 11:59pm
==ROS Framework and brown-ros-pkg==
==ROS Framework and brown-ros-pkg==
Line 19: Line 20:
A primary motivation of ROS is to facilitate modular design and reuse of software components, portability across robot hardware, and programming language independence.  Central to ROS is the concept of a [http://www.ros.org/wiki/ROS/Technical%20Overview#Node ROS '''node'''], ROS's basic building block.  Each node is a modular process with some specialized purpose. For example, there may be a node that handles the basic movement of the robot, and there may be another node that simply publishes information from a camera. From these simple nodes, nodes performing more complex behavior can be created. For example, a node can be created to recognize objects from information provided by the camera driver node.  Further, another node take in information about recognized objects and output commands that move the robot to follow selected objects.   
A primary motivation of ROS is to facilitate modular design and reuse of software components, portability across robot hardware, and programming language independence.  Central to ROS is the concept of a [http://www.ros.org/wiki/ROS/Technical%20Overview#Node ROS '''node'''], ROS's basic building block.  Each node is a modular process with some specialized purpose. For example, there may be a node that handles the basic movement of the robot, and there may be another node that simply publishes information from a camera. From these simple nodes, nodes performing more complex behavior can be created. For example, a node can be created to recognize objects from information provided by the camera driver node.  Further, another node take in information about recognized objects and output commands that move the robot to follow selected objects.   
-
Nodes exchange information over an IP network as [http://www.ros.org/wiki/Messages '''messages''']  that are [http://www.ros.org/wiki/Topics '''topics'''] (handled in a [http://en.wikipedia.org/wiki/Publish/subscribe publish-subscribe] manner) or [http://www.ros.org/wiki/Services '''services'''] (handled in a [http://en.wikipedia.org/wiki/Request-response request-response] manner).  To moderate communication in ROS, there a special node called the [http://www.ros.org/wiki/Master '''master node''']. Conceptually, this node is a matchmaker that is responsible connecting '''publishers''' to '''subscribers''' (or requesters to services) for data messages of a particular ROS [http://www.ros.org/wiki/Topics '''topic'''].  Once nodes are matched, the publishing node will talk directly to its subscriber(s).  An illustrations of how ROS performs matchmaking is shown, with an additional example [[File:rosmaster.pdf | here]].  ROS also uses a [http://www.ros.org/wiki/Parameter%20Server parameter server] to pass arguments to nodes from the command line using [http://www.ros.org/wiki/rosparam rosparam].
+
Nodes exchange information over an IP network as [http://www.ros.org/wiki/Messages '''messages''']  for communicating [http://www.ros.org/wiki/Topics '''topics'''] (handled in a [http://en.wikipedia.org/wiki/Publish/subscribe publish-subscribe] manner) or [http://www.ros.org/wiki/Services '''services'''] (handled in a [http://en.wikipedia.org/wiki/Request-response request-response] manner). <!-- analogy of topics to stream/file handle and message to objects/tokens--> To moderate communication in ROS, there a special node called the [http://www.ros.org/wiki/Master '''master node''']. Conceptually, this node is a matchmaker that is responsible connecting '''publishers''' to '''subscribers''' (or requesters to services) for data messages of a particular ROS [http://www.ros.org/wiki/Topics '''topic'''].  Once nodes are matched, the publishing node will talk directly to its subscriber(s).  An illustrations of how ROS performs matchmaking is shown (with an additional example, [[File:rosmaster.pdf|here]]).  ROS also uses a [http://www.ros.org/wiki/Parameter%20Server parameter server] to pass arguments to nodes from the command line using [http://www.ros.org/wiki/rosparam rosparam].
-
Although ROS nodes can be developed in any programming language that can support ROS messages, the only fully supported [http://www.ros.org/wiki/Client%20Libraries ROS client libraries] are currently for Python and C++.  brown-ros-pkg provides a package [http://code.google.com/p/brown-ros-pkg/wiki/rosjs Javascript support for ROS] using [http://en.wikipedia.org/wiki/WebSockets websockets].
+
Although ROS nodes can be developed in any programming language that can support ROS messages, the only fully supported [http://www.ros.org/wiki/Client%20Libraries ROS '''client libraries'''] are currently for Python and C++.  brown-ros-pkg provides a package [http://code.google.com/p/brown-ros-pkg/wiki/rosjs Javascript support for ROS] using [http://en.wikipedia.org/wiki/WebSockets websockets].
    
    
A more complete [http://www.ros.org/wiki/ROS/Introduction conceptual and technical overview of ROS] is described on the main ROS web site.
A more complete [http://www.ros.org/wiki/ROS/Introduction conceptual and technical overview of ROS] is described on the main ROS web site.
-
As [http://people.csail.mit.edu/albert/pubs/2010-huang-olson-moore-lcm-iros.pdf surveyed by Huang et al.], it should be noted that ROS is only one of many viable robot middleware frameworks.  Also, the core functionality of ROS is to perform socket-based [http://en.wikipedia.org/wiki/Inter-process_communication inter-process communication], or "communications and marshalling" as described for the [http://code.google.com/p/lcm/LCM LCM] library.  The "robot" aspects of ROS are due to its support for robot-related devices and software, which are a complementary but orthogonal features to inter-process communication.
+
As [http://dspace.mit.edu/bitstream/handle/1721.1/46708/MIT-CSAIL-TR-2009-041.pdf?sequence=1 surveyed by Huang et al.], it should be noted that ROS is only one of many viable robot middleware frameworks.  Also, the core functionality of ROS is to perform socket-based [http://en.wikipedia.org/wiki/Inter-process_communication inter-process communication], or "communications and marshalling" as described for the [http://code.google.com/p/lcm/LCM LCM] library.  The "robot" aspects of ROS are due to its support for robot-related devices and software, which are a complementary but orthogonal features to inter-process communication.
===ROS for the iRobot Create===
===ROS for the iRobot Create===
Line 33: Line 34:
===ROS as a Build Environment===
===ROS as a Build Environment===
-
In addition to providing a software interface for robots, ROS also provides a build environment for software development that resembles a [http://en.wikipedia.org/wiki/Package_management_system package management system].  The [http://www.ros.org/wiki/Packages package] is the primary element in the ROS build environment "that logically constitutes a useful module."  A package is typically a directory containing a collection of ROS nodes with related files, such as [http://www.ros.org/wiki/srv service] and [http://www.ros.org/wiki/msg message] definitions, [http://en.wikipedia.org/wiki/Make_(software) makefiles], and external libraries.  Packages can be compiled using the [http://www.ros.org/wiki/rosmake rosmake] or [http://www.ros.org/wiki/rosdep rosdep] commands, handling the process of building executable nodes and "some special ROS magic."  The ROS build system uses [http://en.wikipedia.org/wiki/CMake CMake] at its core.  Packages can be created using the [http://www.ros.org/wiki/roscreate roscreate-pkg] command, providing a skeleton of a valid package as a starting point.  Dependencies for a package can be found using the [http://www.ros.org/wiki/rospack rospack] command.
+
In addition to providing a software interface for robots, ROS also provides a build environment for software development that resembles a [http://en.wikipedia.org/wiki/Package_management_system package management system].  The [http://www.ros.org/wiki/Packages '''package'''] is the primary element in the ROS build environment "that logically constitutes a useful module."  A package is typically a directory containing a collection of ROS nodes with related files, such as [http://www.ros.org/wiki/srv '''service'''] and [http://www.ros.org/wiki/msg '''message'''] definitions, [http://en.wikipedia.org/wiki/Make_(software) makefiles], and external libraries.  Packages can be compiled using the [http://www.ros.org/wiki/rosmake rosmake] or [http://www.ros.org/wiki/rosdep rosdep] commands, handling the process of building executable nodes and "some special ROS magic."  The ROS build system uses [http://en.wikipedia.org/wiki/CMake CMake] at its core.  Packages can be created using the [http://www.ros.org/wiki/roscreate roscreate-pkg] command, providing a skeleton of a valid package as a starting point.  Dependencies for a package can be found using the [http://www.ros.org/wiki/rospack rospack] command.
   
   
As you may have noticed, ROS tends to rosinvent existing unix tools for easier navigation of ROS packages.  For example, [http://www.ros.org/wiki/rosbash rosbash] includes several ros-ified commands such as roscd, rosls, etc.
As you may have noticed, ROS tends to rosinvent existing unix tools for easier navigation of ROS packages.  For example, [http://www.ros.org/wiki/rosbash rosbash] includes several ros-ified commands such as roscd, rosls, etc.
Line 39: Line 40:
==ROS support packages==
==ROS support packages==
-
;irobot_create_2_1
+
;ROS installation instructions (optional)
-
:irobot_create_2_1
+
:Although cs148 robots have ROS and support packages preinstalled, you can look under the [http://code.google.com/p/brown-ros-pkg/ "Getting Started" section of brown-ros-pkg] to install these packages on your own computer.  The current version of ROS is C-Turtle.  For [http://en.wikipedia.org/wiki/Ubuntu_(operating_system) Ubuntu Linux], C-Turtle installation is essentially an [http://en.wikipedia.org/wiki/Apt-get apt-get] of the [http://www.ros.org/wiki/cturtle/Installation/Ubuntu ROS binary package] and running an automated script ([http://code.google.com/p/brown-ros-pkg/source/browse/tags/getros/getros.py getros.py]) from brown-ros-pkg.  Installation for other operating systems is similar, but can involve some customization of the installation process.
-
;teleop_twist_keyboard
+
;[http://code.google.com/p/brown-ros-pkg/wiki/irobot_create_2_1 irobot_create_2_1] (brown-ros-pkg)
-
:teleop_twist_keyboard
+
:ROS driver for the iRobot Create mobile robot base
 +
 
 +
;[http://code.google.com/p/brown-ros-pkg/wiki/teleop_twist_keyboard teleop_twist_keyboard] (brown-ros-pkg)
 +
:ROS package for keyboard teleoperation of a mobile robot base.  Adapted from the [http://playerstage.sourceforge.net/doc/Player-1.6.5/player-html/group__player__util__playerjoy.php playerjoy] utility for Player.
==Assignment Instructions==
==Assignment Instructions==
Line 59: Line 63:
#Write your own random traversal controller
#Write your own random traversal controller
#Commit to your group's repository
#Commit to your group's repository
-
#Experiments and Reporting
+
#Conduct experiments and Reporting
===Setup remote access to the robot's netbook===
===Setup remote access to the robot's netbook===
Line 72: Line 76:
===Run ROS and teleoperate the robot===
===Run ROS and teleoperate the robot===
-
* Create a temporary working directory, called <YOUR GROUPNAME>, in the home directory of the laptop you are ssh'd into.
+
<!--* Over your ssh connection, ensure your shell environment variables are set correctly with the following commands (assuming ROS C Turtle release):
-
* Ensure your shell environment variables are set correctly with the following commands (assuming ROS C Turtle release):
+
  > source /opt/ros/cturtle/setup.sh -->
-
  > source /opt/ros/cturtle/setup.sh
+
-
> export ROS_PACKAGE_PATH=WORKING_DIRECTORY:$ROS_PACKAGE_PATH
+
-
: where WORKING_DIRECTORY should be set to your group's temporary working directory, which will be later created as /home/obot/ros/<YOUR GROUPNAME>
+
* In the background on your ssh connection or in a separate terminal on the netbook, start the ROS master with the [http://www.ros.org/wiki/roscore roscore] command:
-
 
+
  > roscore  
-
* On the robot's netbook, start the ROS master with the [http://www.ros.org/wiki/roscore roscore] command:
+
-
  > roscore
+
: The ROS Master must be running for other ROS nodes locate each other and communicate.  Most ROS nodes will fail if a roscore is not running.  
: The ROS Master must be running for other ROS nodes locate each other and communicate.  Most ROS nodes will fail if a roscore is not running.  
-
* In a separate terminal shell on the netbook, start the [http://code.google.com/p/brown-ros-pkg/wiki/irobot_create_2_1 iRobot Create driver] with the rosrun command:
+
* Start, in the background or in a separate terminal on the netbook, the [http://code.google.com/p/brown-ros-pkg/wiki/irobot_create_2_1 iRobot Create driver] with the rosrun command:
  > rosrun irobot_create_2_1 driver.py  
  > rosrun irobot_create_2_1 driver.py  
-
* In (yet) another terminal shell on the netbook, start the robot [http://en.wikipedia.org/wiki/Teleoperation teleoperation] node for [http://code.google.com/p/brown-ros-pkg/wiki/teleop_twist_keyboard teleop_twist_keyboard] with the command:  
+
* Secure the netbook to the robot, and start the robot [http://en.wikipedia.org/wiki/Teleoperation teleoperation] node for [http://code.google.com/p/brown-ros-pkg/wiki/teleop_twist_keyboard teleop_twist_keyboard] from your ssh'd terminal with the command:  
  > rosrun teleop_twist_keyboard teleop_twist_keyboard.py
  > rosrun teleop_twist_keyboard teleop_twist_keyboard.py
Line 112: Line 112:
It is highly recommended that you go through the [http://www.ros.org/wiki/ROS/Tutorials ROS tutorials] on ros.org.  These instructions roughly follow the [http://www.ros.org/wiki/ROS/Tutorials/WritingPublisherSubscriber(python) ROS tutorial on creating a simple publisher and subscriber].  We skip over several helpful details and features in the interest of being concise.
It is highly recommended that you go through the [http://www.ros.org/wiki/ROS/Tutorials ROS tutorials] on ros.org.  These instructions roughly follow the [http://www.ros.org/wiki/ROS/Tutorials/WritingPublisherSubscriber(python) ROS tutorial on creating a simple publisher and subscriber].  We skip over several helpful details and features in the interest of being concise.
-
* In a terminal shell on the robot's netbook, create a temporary projects directory for your group with the command:
+
* Create a temporary projects directory for your group with the command and change directory into it:
-
  > cd /home/obot/ros/GROUPNAME
+
> mkdir /home/obot/ros/<GROUPNAME>
 +
  > cd /home/obot/ros/<GROUPNAME>
-
: where <tt>GROUPNAME</tt> is the name of your group
+
: where <tt><GROUPNAME></tt> is the name of your group
 +
 
 +
* '''NOTE:''' If there are other groups' folders on this laptop, '''remove them'''. The ros package path is set to <tt>/home/obot/ros</tt>, and so if there is another folder in <tt>/home/obot/ros</tt> that contains a package of the same name as the one you are creating, ros will complain. It is class policy delete your code from a laptop after you commit it, for this reason, and to also adhere to the academic code.
* Create a ROS package for your enclosure escape code using the [http://www.ros.org/wiki/roscreate roscreate-pkg] command:  
* Create a ROS package for your enclosure escape code using the [http://www.ros.org/wiki/roscreate roscreate-pkg] command:  
Line 123: Line 126:
: This automatically creates a directory called enclosure_escape with direct dependencies on two other packages [http://www.ros.org/wiki/rospy rospy] (ROS Python client library) and [http://code.google.com/p/brown-ros-pkg/wiki/irobot_create_2_1 iRobot Create driver].  These packages depend on several other packages, which can be found using the [http://www.ros.org/wiki/rospack rospack] command. roscreate generates a number of files for building the new package, as described in the [http://www.ros.org/wiki/ROS/Tutorials/CreatingPackage roscreate tutorial].  
: This automatically creates a directory called enclosure_escape with direct dependencies on two other packages [http://www.ros.org/wiki/rospy rospy] (ROS Python client library) and [http://code.google.com/p/brown-ros-pkg/wiki/irobot_create_2_1 iRobot Create driver].  These packages depend on several other packages, which can be found using the [http://www.ros.org/wiki/rospack rospack] command. roscreate generates a number of files for building the new package, as described in the [http://www.ros.org/wiki/ROS/Tutorials/CreatingPackage roscreate tutorial].  
 +
* Change directory into the <tt>enclosure_escape</tt> package:
 +
> roscd enclosure_escape
-
----
+
* Create the <tt>nodes</tt> directory within the <tt>enclosure_escape</tt> package:
-
----
+
-
----
+
-
Note: need to sort out repository structure before finishing this
+
-
Move into this \texttt{enclosure\_escape} directory: \texttt{cd enclosure\_escape}
+
> mkdir nodes
-
* Change directory into the enclosure_escape package:
+
* Create a file called <tt>nodes/enclosure_escape.py</tt>, and paste the following inside it:
-
> roscd beginner_tutorials
 
-
 
-
* Create the <tt>nodes/hello_create.py</tt> file within the enclosure_escape package and paste the following inside it:
 
-
 
-
 
  #!/usr/bin/env python
  #!/usr/bin/env python
  import roslib; roslib.load_manifest('enclosure_escape')
  import roslib; roslib.load_manifest('enclosure_escape')
Line 182: Line 179:
Make the source for this node is executable:
Make the source for this node is executable:
-
  > chmod +x nodes/hello_create.py
+
  > chmod +x nodes/enclosure_escape.py
* compile the enclosure_escape package
* compile the enclosure_escape package
Line 188: Line 185:
  > rosmake enclosure_escape
  > rosmake enclosure_escape
-
* run the hello_create node, assume roscore and irobot_create_2_1 are still running
+
* run the enclosure_escape node, assume roscore and irobot_create_2_1 are still running
-
  > rosrun enclosure_escape hello_create.py
+
  > rosrun enclosure_escape enclosure_escape.py
-
:if successful, you should see the robot spin in place
+
:if successful, you should see the robot move forward at an angle, and stop when it bumps into something.
-
* copy the hello_create.py to the file enclosure_escape.py and modify enclosure_escape.py to perform random traversal
+
* Modify enclosure_escape.py to perform random traversal
===Committing your package to your repository===
===Committing your package to your repository===
Line 202: Line 199:
We expect your repository to have one folder for each project. While you will be able to view or tamper with the repositories of other groups, doing so is a violation of the honor code and we'll notice.  
We expect your repository to have one folder for each project. While you will be able to view or tamper with the repositories of other groups, doing so is a violation of the honor code and we'll notice.  
-
To get a copy of your empty repository, use this command:
+
Because your repositories will be saved on the department file system, but the code needs to be on the netbooks, we will be using a git daemon to send the git actions.
-
  > git clone /course/cs148/repo/groupname
+
First, on a department machine, run the git daemon using this command:
 +
  > git daemon --verbose --export-all --enable=receive-pack
-
Put the code you've been working on in groupname/escape and then, from that directory, run:
+
Now, in your ssh connection (or on the netbook), get a copy of your empty repository, use this command:
 +
 
 +
> git clone git://<IP ADDRESS>/course/cs148/repo/<GROUPNAME>.git
 +
: where <tt><IP ADDRESS></tt> is the ip address of the computer running the git daemon, which is likely one of the machines in 404 (currently pitman or pele).
 +
 
 +
Put the code you've been working on in <tt><GROUPNAME>/escape</tt> and then, from that directory, run:
  > git add .
  > git add .
Line 253: Line 256:
===Experiments and Reporting===
===Experiments and Reporting===
-
conduct least 3 trials at 3 different start locations in 3 different environments. measure total time, number of collisions.  all of your trials must use the same controller '''without modification'''.
+
You are expected to conduct least 3 trials at 3 different start locations in 3 different enclosure environments. Measure and report total time for escape and number of collisions during each trialAll of your trials must use the same controller '''without modification'''.
 +
 
 +
Document your controller and experimental results in a written report based on the structure described in the [http://brown-robotics.org/index.php?title=CS148_Missive#Project_Report_Format course missive].  You are welcome to experiment with additional enclosure escape algorithms and evaluate the relative performance of each.  When completed, your report should be committed to the <tt>enclosure_escape/docs/username</tt> directory of the repository that you have created.
-
Document your controller and experimental results in a written report.  You are welcome to experiment with various enclosure escape algorithms and evaluate the relative performance of each. The details of how this report is graded are discussed in the following section.  Example reports are provided in the ``Documents" section of the \href{http://www.cs.brown.edu/courses/cs148/}{course website}.  When finished, your report should be committed to the <tt>enclosure_escape/docs</tt> directory of the repository that you checked out.
+
<!-- conduct least 3 trials at 3 different start locations in 3 different environments. measure total time, number of collisions.  all of your trials must use the same controller '''without modification'''.
 +
Document your controller and experimental results in a written report.  You are welcome to experiment with various enclosure escape algorithms and evaluate the relative performance of each. The details of how this report is graded are discussed in the following section.  Example reports are provided in the ``Documents" section of the \href{http://www.cs.brown.edu/courses/cs148/}{course website}.  When finished, your report should be committed to the <tt>enclosure_escape/docs</tt> directory of the repository that you checked out. -->
==Grading==
==Grading==

Current revision as of 18:54, 5 October 2010

Contents

Introduction

Toy robot finding its way

This project is structured to acquaint you with the basics of writing robot controllers using ROS (the Robot Operating System) in the context of building an "enclosure escape" robot controller. ROS runs onboard a robot (or any computing device) and provides a software interface to the robot hardware, such as sensors and actuators, over an IP network. Similar to a hardware abstraction layers for modern operating systems, ROS is considered robot middleware to facilitate portability across robot hardware and reusability of robot software components.

A video of Lisa Miller's implementation of this assignment from Spring Semester 2009.

Important Dates

Project Assigned: Sept 3, 2010

Project Due: Sept 17, 2010, 11:59pm

ROS Framework and brown-ros-pkg

ROS for Robot Control

A primary motivation of ROS is to facilitate modular design and reuse of software components, portability across robot hardware, and programming language independence. Central to ROS is the concept of a ROS node, ROS's basic building block. Each node is a modular process with some specialized purpose. For example, there may be a node that handles the basic movement of the robot, and there may be another node that simply publishes information from a camera. From these simple nodes, nodes performing more complex behavior can be created. For example, a node can be created to recognize objects from information provided by the camera driver node. Further, another node take in information about recognized objects and output commands that move the robot to follow selected objects.

Nodes exchange information over an IP network as messages for communicating topics (handled in a publish-subscribe manner) or services (handled in a request-response manner). To moderate communication in ROS, there a special node called the master node. Conceptually, this node is a matchmaker that is responsible connecting publishers to subscribers (or requesters to services) for data messages of a particular ROS topic. Once nodes are matched, the publishing node will talk directly to its subscriber(s). An illustrations of how ROS performs matchmaking is shown (with an additional example, File:Rosmaster.pdf). ROS also uses a parameter server to pass arguments to nodes from the command line using rosparam.

Although ROS nodes can be developed in any programming language that can support ROS messages, the only fully supported ROS client libraries are currently for Python and C++. brown-ros-pkg provides a package Javascript support for ROS using websockets.

A more complete conceptual and technical overview of ROS is described on the main ROS web site.

As surveyed by Huang et al., it should be noted that ROS is only one of many viable robot middleware frameworks. Also, the core functionality of ROS is to perform socket-based inter-process communication, or "communications and marshalling" as described for the LCM library. The "robot" aspects of ROS are due to its support for robot-related devices and software, which are a complementary but orthogonal features to inter-process communication.

ROS for the iRobot Create

The brown-ros-pkg is a collection of nodes that includes basic sensing and movement functionality for the iRobot Create. For this assignment, you will be using the irobot_create_2_1 package. irobot_create_2_1 publishes messages of the robot's current sensing (e.g., whether the robot's left or right bumper is pressed) and has services for controlling the robot (e.g., the robot's driving speed and rotation).

ROS as a Build Environment

In addition to providing a software interface for robots, ROS also provides a build environment for software development that resembles a package management system. The package is the primary element in the ROS build environment "that logically constitutes a useful module." A package is typically a directory containing a collection of ROS nodes with related files, such as service and message definitions, makefiles, and external libraries. Packages can be compiled using the rosmake or rosdep commands, handling the process of building executable nodes and "some special ROS magic." The ROS build system uses CMake at its core. Packages can be created using the roscreate-pkg command, providing a skeleton of a valid package as a starting point. Dependencies for a package can be found using the rospack command.

As you may have noticed, ROS tends to rosinvent existing unix tools for easier navigation of ROS packages. For example, rosbash includes several ros-ified commands such as roscd, rosls, etc.

ROS support packages

ROS installation instructions (optional)
Although cs148 robots have ROS and support packages preinstalled, you can look under the "Getting Started" section of brown-ros-pkg to install these packages on your own computer. The current version of ROS is C-Turtle. For Ubuntu Linux, C-Turtle installation is essentially an apt-get of the ROS binary package and running an automated script (getros.py) from brown-ros-pkg. Installation for other operating systems is similar, but can involve some customization of the installation process.
irobot_create_2_1 (brown-ros-pkg)
ROS driver for the iRobot Create mobile robot base
teleop_twist_keyboard (brown-ros-pkg)
ROS package for keyboard teleoperation of a mobile robot base. Adapted from the playerjoy utility for Player.

Assignment Instructions

For this assignment, you will be expected to work with an existing installation of ROS to write a simple random traversal controller to escape a static environment.

Before writing your own controller, you must first setup the robot and verify that it is running properly. Once your controller is completed, you will implement a random traversal controller run experiments to evaluate how well your system can escape from an enclosed area.

  • Note: lets revisit these instructions based on infrastructure updates

Your tasks for this assignment are as follows.

  1. Setup remote access to the robot's netbook
  2. Run ROS and teleoperate the robot
  3. Write your own random traversal controller
  4. Commit to your group's repository
  5. Conduct experiments and Reporting

Setup remote access to the robot's netbook

  • Ask one of the TAs for access to the Roomba Lab (CIT 404), an iRobot Create, and an IP address. Choose an appropriate name for your group, which the TA will use to create a repository that will be used later in this assignment.
  • Turn on the iRobot Create and the mounted netbook computer. Make sure that the netbook is connected to the AIBO wireless network (no password is necessary).
  • Each netbook has an IP address in the form 10.100.0.x, where x is posted next to each robot name on the whiteboard in the Roobma Lab. Determine the IP address for the robot you are currently working with by looking at the whiteboard or by running the command /sbin/ifconfig on the computer.
  • From a stationary Roomba Lab computer (or your personal laptop) connected to the AIBO network, open a terminal enter the command:
> ssh obot@IPADDRESS
where IPADDRESS is the IP address of your robot. This will allow you to remotely connect to the robot's netbook, such that you do not have to do your coding on a small laptop. (Note: should we discuss ssh forwarding?)
If successful, you should have a remote terminal shell on the netbook and be able to navigate its filesystem with standard unix commands.

Run ROS and teleoperate the robot

  • In the background on your ssh connection or in a separate terminal on the netbook, start the ROS master with the roscore command:
> roscore 
The ROS Master must be running for other ROS nodes locate each other and communicate. Most ROS nodes will fail if a roscore is not running.
  • Start, in the background or in a separate terminal on the netbook, the iRobot Create driver with the rosrun command:
> rosrun irobot_create_2_1 driver.py 
> rosrun teleop_twist_keyboard teleop_twist_keyboard.py

If successful, you should see the following interface appear in the teleoperation terminal and control the robot (driving and turning speed) from your keyboard.

Be careful: the robot will continue to execute the last command given.

Reading from the keyboard  and Publishing to Twist!
---------------------------
Moving around:
   u    i    o
   j    k    l
   m    ,    .

q/z : increase/decrease max speeds by 10%
w/x : increase/decrease only linear speed by 10%
e/c : increase/decrease only angular speed by 10%
anything else : stop

CTRL-C to quit

Write your own random traversal controller

It is highly recommended that you go through the ROS tutorials on ros.org. These instructions roughly follow the ROS tutorial on creating a simple publisher and subscriber. We skip over several helpful details and features in the interest of being concise.

  • Create a temporary projects directory for your group with the command and change directory into it:
> mkdir /home/obot/ros/<GROUPNAME>
> cd /home/obot/ros/<GROUPNAME>
where <GROUPNAME> is the name of your group
  • NOTE: If there are other groups' folders on this laptop, remove them. The ros package path is set to /home/obot/ros, and so if there is another folder in /home/obot/ros that contains a package of the same name as the one you are creating, ros will complain. It is class policy delete your code from a laptop after you commit it, for this reason, and to also adhere to the academic code.
  • Create a ROS package for your enclosure escape code using the roscreate-pkg command:
> roscreate-pkg enclosure_escape rospy std_msgs irobot_create_2_1
This automatically creates a directory called enclosure_escape with direct dependencies on two other packages rospy (ROS Python client library) and iRobot Create driver. These packages depend on several other packages, which can be found using the rospack command. roscreate generates a number of files for building the new package, as described in the roscreate tutorial.
  • Change directory into the enclosure_escape package:
> roscd enclosure_escape
  • Create the nodes directory within the enclosure_escape package:
> mkdir nodes
  • Create a file called nodes/enclosure_escape.py, and paste the following inside it:
#!/usr/bin/env python
import roslib; roslib.load_manifest('enclosure_escape')
import rospy
from geometry_msgs.msg import Twist
from irobot_create_2_1.msg import SensorPacket
# global variables 
bump = False

# listen (adapted from line_follower
def processSensing(sensorPacket):
    global bump
    bump = sensorPacket.bumpLeft or sensorPacket.bumpRight
    #newInfo = True


def hello_create():
    pub = rospy.Publisher('cmd_vel', Twist)
    rospy.Subscriber('sensorPacket', SensorPacket, processSensing)
    rospy.init_node('hello_create')
    #listen
    global bump
    twist = Twist()
    while not rospy.is_shutdown():
        if bump:
            str = "hello create, you have bumped into something  %s"%rospy.get_time()
            rospy.loginfo(str)
            twist.linear.x = 0; twist.linear.y = 0; twist.linear.z = 0
            twist.angular.x = 0; twist.angular.y = 0; twist.angular.z = 0
            bump = False
        else:
            str = "hello create, you can spin now %s"%rospy.get_time()
            rospy.loginfo(str)
            twist.linear.x = 0.1; twist.linear.y = 0; twist.linear.z = 0
            twist.angular.x = 0; twist.angular.y = 0; twist.angular.z = 0.1
        pub.publish(twist)
        rospy.sleep(1.0)
if __name__ == '__main__':
    try:
        hello_create()
    except rospy.ROSInterruptException: pass

Make the source for this node is executable:

> chmod +x nodes/enclosure_escape.py
  • compile the enclosure_escape package
> rosmake enclosure_escape
  • run the enclosure_escape node, assume roscore and irobot_create_2_1 are still running
> rosrun enclosure_escape enclosure_escape.py
if successful, you should see the robot move forward at an angle, and stop when it bumps into something.
  • Modify enclosure_escape.py to perform random traversal

Committing your package to your repository

The enclosure escape package should be committed to your group's repository. The package we have just created is in a temporary working space on the laptop that could be deleted at any time. Checking your package into a repository on the CS filesystem ensures your code is accessible by everyone in your group and the course staff, protected, backed up, and version controlled to prevent conflicts during collaborative coding. Please read this git tutorial thoroughly at least through the end of chapter four; for now the important parts are below, but you should know everything in this tutorial. Before starting here, be sure you've told the TAs your group name so that you have a repository in the course directory.

We expect your repository to have one folder for each project. While you will be able to view or tamper with the repositories of other groups, doing so is a violation of the honor code and we'll notice.

Because your repositories will be saved on the department file system, but the code needs to be on the netbooks, we will be using a git daemon to send the git actions.

First, on a department machine, run the git daemon using this command:

> git daemon --verbose --export-all --enable=receive-pack 

Now, in your ssh connection (or on the netbook), get a copy of your empty repository, use this command:

> git clone git://<IP ADDRESS>/course/cs148/repo/<GROUPNAME>.git
where <IP ADDRESS> is the ip address of the computer running the git daemon, which is likely one of the machines in 404 (currently pitman or pele).

Put the code you've been working on in <GROUPNAME>/escape and then, from that directory, run:

> git add .
> git commit -a -m "My first commit!"
> git push

The last line puts your code into the repository in the course directory.

In order to synchronize your code with the repository, use this command:

> git pull


Experiments and Reporting

You are expected to conduct least 3 trials at 3 different start locations in 3 different enclosure environments. Measure and report total time for escape and number of collisions during each trial. All of your trials must use the same controller without modification.

Document your controller and experimental results in a written report based on the structure described in the course missive. You are welcome to experiment with additional enclosure escape algorithms and evaluate the relative performance of each. When completed, your report should be committed to the enclosure_escape/docs/username directory of the repository that you have created.


Grading

Your grade for this assignment will be determined by equal weighting of your group's implementation (50\%) and your individual written report (50\%). The weighted breakdown of grading factors for this assignment are as follows:

Project Implementation

Movement Control 20%
Does your robot move smoothly in the environment?
Obstacle Reaction 20%
Does your robot reasonably detect and respond to obstacles?
Controller Robustness 10%
Does your controller run without interruption?

Written Report

Introduction and Problem Statement 7%
What is your problem?
Why is it interesting?
Approach and Methods 15%
What is your approach to the problem?
How did you implement your approach and algorithms?
Could someone reproduce your algorithms?
Experiments and Results 20%
How did you validate your methods?
Describe your variables, controls, and specific tests.
Could someone reproduce your results?
Conclusion and Discussion 8%
What conclusions can be reached about your problem and approach?
What are the strengths of your approach?
What are the shortcomings of your approach?




Personal tools