Page tree
Skip to end of metadata
Go to start of metadata

Preliminaries

Update ROS Packages

On your desk/laptop please update the nre_p3at and nre_joy packages.  We've added some additional scripts that we will use for this week.  Git should make this fairly easy...

roscd nre_p3at
git pull 
 
roscd nre_joy
git pull

You should see that git has updated your local copies of these repositories.

Git RFID Package

On your desk/laptop, clone the repository for the Sparkfun RFID reader (we'll use this sensor to detect "mines").

cd ~/catkin_ws/src
git clone https://github.com/bsb808/sparkfun_rfid.git
source ~/catkin_ws/devel/setup.bash

Remove IMU

  • Please remove the UM7 IMU from your robot and put the device and the USB cable away.

Collaboration

  • You are encouraged to work with a partner when working with the robots.  Having one person 'pilot' the robot from the computer and another to physically supervise the robot seems ideal.  You are free to share the collected data when generating the deliverables.

 

Setup Assignment Git Repository / ROS Package

As in the last few assignments, your submission for this assignment will be a Git repository that contains a ROS package.  The name of the repository on the gitlab.nps.edu server should be mrc_hw8 and it should be a ROS package (catkin_crate_pkg).  

RFID Bench Test

Before installing  the RFID reader on the robot, test the device on your desk/laptop.

  1. Connect the RFID sensor to your computer via USB.
  2. Determine which port the device is connected to using dmesg...

    dmesg | tail

    which should generate some cryptic output - look for a line with something similar to
    usb 1-2: FTDI USB Serial Device converter now attached to ttyUSB0
    This will tell you what port the devices is attached to - in this case it is /dev/ttyUSB0.

  3. Launch the sparkfun_rfid node
    1. If you determined that the sensor is connected to port=/dev/ttyUSB0, then you can launch the node like this...

      roslaunch sparkfun_rfid rfid.launch
    2. If the sensor is on a different port (e.g., /dev/ttyUSB1) then you will need to supply the port argument like so...

      roslaunch sparkfun_rfid rfid.launch port:=/dev/ttyUSB1
  4. Test the sensor as follows:
    1. Using rostopic or rqt_topic, monitor the topic named "/rfid"
    2. Pass an RFID near the sensor (it will beep when it detects a tag) and verify that you receive a ROS String message with the unique ID number of the tag.  Here is a screenshot:
    3. Experiment with different distances to understand how close the sensor needs to be to the tag.

RFID Integration

Next we you will need to mount the RFID sensor.  It will need to be 2-3" from the ground to be able to detect the RFID tags.  

Connect the RFID sensor to the shuttle computer via USB and arrange the cabling to keep it clear of the moving robot.

Exercise 1: Indoor Joystick "Mine" Search

Introduction

The goal of this exercise is to test your installation of the RFID sensor to verify that it can detect RFID tags on th ground.  You will post-process the data to estimate the location of these detections.

Procedure

  1. Begin with the Pioneer at the origin of the indoor coordinate frame, with the front of the vehicle pointing along the X direction.

  2. Place a strip of RFID tags roughly 3 m from the origin, along the X direction.
  3. Desk/Laptop: Start ROS master and joystick
    1. Note that we've implemented a watchdog timer on the robot, so driving by joystick will require constant small movements.  We will discuss this in class/lab.
      NOTE: you must be connected to wifi before running this command. 

      rosrun nre_joy runmrc_base_joy.sh

      This script should set the appropriate ROS environmental variables for your IP address and then call roslaunch to start the ROS master and the joystick nodes.

  4. Shuttle: Start the robot software
    1. This starts the the robot, GPS, and RFID drivers; and the watchdog.
    2. You will need to restart the Rosaria node for each experiment to zero the odometry estimate.

      rosrun nre_p3at runmrc_shuttle.sh 192.168.11.120

      NOTE - This script takes as an argument the IP address of the ROS Master, so you will need to substitute the IP address of your desk/laptop in the above command!
       

  5. Desk/Laptop: OPTIONAL Start any visualization you will use for debugging (rviz, rqt_topic, etc.).  We have included a launch file in the nre_p3at package to start rviz with the appropriate configuration, as well as rqt_topic and rqt_graph.

    roslaunch nre_p3at devtoolsP3.launch
  6. Check that all the nodes are running.  The rqt_graph should look something like.
     

    You might also verify that your robot pose is X=0, Y=0
     

  7. Desk/Laptop: Start a rosbag file to record the experiment.  

    rosbag record -O mine.bag /my_p3at/pose /my_p3at/cmd_vel /fix /rfid

    Note: In the next exercise we record the log file on the robot (Shuttle PC) in order to reduce the network traffic.  If you have connectivity problems during the experiment, you might try recording the log file on the shuttle PC and then using scp to copy the log file to your desk/laptop.

     

  8. Once everything is running, use the joystick to drive the Pioneer from the origin to the RFID tag strip.  You should hear the sensor beep and see that the ID is beging published to the /rfid topic.
  9. Drive the Pioneer back to the origin.
  10. Stop recording the bag file.

Post-Processing

Use MATLAB to read the mine.bag log file.  You should be able to reuse much of the plotting routines you developed in the previous assignment.

  1. Graph the path of the robot in the odometry frame.  Save this plot as rfid.png.
  2. Generate a second graph of the path of the robot, but add the locations of the detected RFID tags.  Save this plot as rfid_mines.png

Estimating the location of the RFID tags can be done as follows.  We know the time that the messages on the /rfid topic were received.  We want to know the odometry location of the robot when that happened.  The "resample" function allows us to get the odometry pose on the same timebase as the /rfid messages.  Here a snippet to illustrate...

% Extract pose data
bagPose = select(bag,'Topic','/my_p3at/pose')
tsPose = timeseries(bagPose,'Pose.Pose.Position.X','Pose.Pose.Position.Y');

% Extract RFIDdata
bagRfid = select(bag,'Topic','/rfid')
tsRfid = bagRfid.timeseries;

% Resample the Pose data onto the RFID timebase
tsPoseId = resample(tsPose,tsRfid.Time);

Here are examples showing one version of what you might see...

Deliverables

Put the two image files you generated (rfid.png and rfid_mines.png) in your mrc_hw8 repository.  Put them in a directory called "matlab".  Commit and push

Exercise 2: Waypoint Navigation in Odometry Frame

Introduction

The goal of this exercise is to demonstrate navigating your Pioneer through a series of waypoints outdoors.  The waypoints will all be in the non-fixed, relative odometry frame.

We will reuse the waypoint navigation algorithm from Assignment 5: Networking, Pioneer Checkout, Waypoint Navigation.  As you will recall from Assignment 5, we connected  the P3AT directly to your desk/laptop via serial.  Now we should be able to run things wirelessly.

For each run, start the robot at the coordinate frame origin marked outside the CAVR lab.  Align the front of the vehicle with the X direction.  We will operate in a box bounded by the X = 15 m and Y = 5 m.

Reuse MATLAB Code

Copy your MATLAB code from Assignment 5 into your mrc_hw8 repository.

You will need to make (at least) two adjustments to the way you initiate the controller:

  1. Add the IP address of your desk/laptop to the rosinit command (in the example below, the IP address of my laptop is 192.168.11.120, you will need to change this IP addres for your setup.)
  2. Change the waypoint commands so that the robot will transit the perimeter of our operating area twice - once counter-clockwise

Here is an example:

rosinit('http://192.168.11.120:11311', ...
        'NodeHost', '192.168.11.120');
XX = 15;
YY = 5;
pwaypoint(XX,0);
pwaypoint(XX,YY);
pwaypoint(0,YY);
pwaypoint(0,0);
pwaypoint(0,YY);
pwaypoint(XX,YY);
pwaypoint(XX,0);
pwaypoint(0,0);
rosshutdown;

Procedure

Successfully controlling your robot to navigate through the sequence of waypoints will require some interation.  Please work with a partner 

  1. Desk/Laptop: Start ROS master and joystick
    1. Note that we've implemented a watchdog timer on the robot, so driving by joystick will require constant small movements.  We will discuss this in class/lab.

      rosrun nre_joy runmrc_base_joy.sh

      This script should set the appropriate ROS environmental variables for your IP address and then call roslaunch to start the ROS master and the joystick nodes.

  2. Shuttle: Start the robot software
    1. This starts the the robot, GPS, and RFID drivers; and the watchdog.
    2. You will need to restart the Rosaria node for each experiment to zero the odometry estimate.

      rosrun nre_p3at runmrc_shuttle.sh 192.168.11.120

      NOTE - This script takes as an argument the IP address of the ROS Master, so you will need to substitute the IP address of your desk/laptop in the above command!
       

  3. Desk/Laptop: OPTIONAL Start any visualization you will use for debugging (rviz, rqt_topic, etc.).  We have included a launch file in the nre_p3at package to start rviz with the appropriate configuration, as well as rqt_topic and rqt_graph.

    roslaunch nre_p3at devtoolsP3.launch
  4. Shuttle: Start a rosbag file to record the experiment.  Note: We record the logfile on the shuttle to keep network traffic/latency at a minimum.

    rosbag record -O waypoint.bag /my_p3at/pose /my_p3at/cmd_vel /fix /rfid
  5. Desk/Laptop: Execute your MATLAB control code
  6. After a successful run, use scp to transfer the logfile from the shuttle to your desk/laptop.

Post-Processing

Use MATLAB to read the bag file you collected and generate two figures.

  1. A plot of the X,Y position of the robot during the experiment based on the odometry reported on the /my_p3at/pose topic.
    Save this figure as waypoint_odom.png 
  2. A plot of the Lat,Lon position of the robot during the experiment based on the GPS coordinates reported on the /fix topic.
    Save this figure as waypoint_gps.png 

Deliverables

You should add your MATLAB control code and your figures to your mrc_hw8 repository in a directory called matlab.

Summary

The deliverables for the two exercises should all go in the matlab directory of your mrc_hw8 repository.

 

 

  • No labels