Scout

July, 2014 – May, 2015

Robo-Magellan competitions have always been intriguing to me because of the purely autonomous nature of the challenge.  I decided to build my own version of this to gain a deeper appreciation of the challenges involved.

0524152329a_resized

Scout is an all-terrain, self-navigating robot designed to quickly orient, navigate and move toward an orange traffic cone.  It was built with a Robo-Magellan competition in mind, although I have no immediate plans to attend one.  My dream would be to someday attend the Sparkfun AVC in Colorado, but I won’t even think about going until I’m sure Scout is performing as desired.

Operation:

  1. Place Scout at the target location (orange cone).
  2. Press the button once for it to get a confirmed GPS signal to be stored into memory as the target.
  3. Move Scout to the starting position
  4. Press the button again for it to initiate the navigation
  5. Scout will autonomously navigate around obstacles toward the destination
  6. When the front bumper touches the cone, the target has been acquired and the motors are shut off

Key Features:

  • Navigates by GPS and visual reference
  • Ruggedized platform with active suspension on 6WD
  • Top speed of about 7 MPH
  • Remote telemetry and kill switch
  • Handle for easy transport
  • Autonomous or RC mode (auto-detect)

0524152329a_resized

Robot Parts:

  • Dagu’s Wild Thumper Chassis – I love everything about this chassis.  The wheels are studded and great for gripping, Its got compartments for storing electronics and batteries, and it’s top platform is Actobotic-friendly (hole spacing).  All 6 wheels have 7.2V gear motors, and it uses a differential steering system that allows for zero-point turns.  It comes with a clever spring-loaded suspension system that is adjustable.  The middle pair of wheels is raised slightly compared to the front and back pair which is good for outdoor usage, but not great for indoor use.
  • Dagu’s T’Rex Motor Controller – Built specifically to work with the Wild Thumper, this is an Arduino Nano-compatible board with a built in dual H-Bridge.  It comes with some nice base code that I’ve heavily modified to suit my needs for this application.  I was very IO pin-constrained on this board, so had to bring in a 2nd board to handle the sensors for navigation.
  • Arduino Due – I needed a microcontroller with a bit more horsepower to drive all the sensors and do some heavy math, so I thought I’d take a shot with the Arduino Due.  After I overcame the issues connecting it to my PC to allow an upload, it worked fine.  For some reason, the Due’s programming port just flat-out stopped working after a while – still not sure why.
  • Pixy Camera – I took a chance and invested in the Pixy (CMUcam5) Camera on Kickstarter and was pleasantly surprised.  I found it very easy to train the Pixy to look for the orange cone and provide real “vision” for Scout.  I’ve had issues with changes in lighting affecting the recognition sometimes (indoor vs. outdoor) and had an issue with the Pixy resetting and shutting down when I was using the I2C interface.  I switched to serial interface and it is working fine.
  • Tenegy 7.2V Batteries – A pair of 5000mAh NiMH rechargable battery packs connected in Parallel provides about 2 hours of run-time.  I selected the ones with the Traxxs to be compatible with my charger.
  • Traxxs Y-cable – for connecting the batteries in parallel
  • Maxbotix HRXL-MaxSonar-WR – I decided to double-down by buying high-end sonar range-finding sensors.  I did a lot of reading and was worried that the inexpensive ultrasonic sensors I’ve been using on other robots (Parallax and other brands) would not work for me outside.  As it turns out, temperature also plays a big role in the effectiveness of these sensors.  I bought 2 of them to be mounted on the top of the front mast for obstacle detection.  I also bought the optional temperature sensor.
  • I have an RGB LED on the back of the platform with a diffuser to let me see the status of visual navigation (blue) or GPS navigation (red).  The remote telemetry also shows this information.
  • MediaTek MT3329 GPS – re-purposed from my quadcopter, this is a really nice sensor with lots of bells and whistles, so I wanted to put it to good use.  After some digging, I found an Arduino library for this board that partially met my needs.  I did some heavy modification to get it to fully meet my needs.
  • Spektrum DX7s controller with AR8000 receiver – re-purposed from my quadcopter, this gives me the ability to remote-control Scout if I need to.
  • The front bumper was custom fabricated using High Density Poly Ethelene (HDPE), a pair of Cherry E22-85HX switches (left over from Talkbot), and an aluminum bar.

0525150034b_resized

Remote Parts

Robot Logic

  •  Power-up
    • Listen for RF controller signal
    • If RF controller signal, beep 1 time, disable autonomous features and allow remote control
    • If no RF controller signal, beep 3 times, proceed with autonomous mode
  • Autonomous Mode
    • Start-up sequence (listed above) to find target and start location
    • Loop until front bumper is pressed
      • Check camera – if visible, navigate exclusively by vision
      • Check GPS – calculate bearing and prepare to move
      • Check ultrasonic sensors – determine if there are any obstacles, and prepare to over-ride navigation to go around obstacles
      • Move
      • Go to the top of the loop

Lessons Learned

  • The Arduino Due is a pain in the neck!  Using this board required me to upgrade to the Arduino v1.5.7Beta version.  “Beta” always makes me worry.  Turns out, I was right to worry.  In addition to having issues with basic uploads on the programming port, I found I had to re-write some basic drivers like SPI.h since libraries are now specific to the hardware used.  I couldn’t get the Fio or the T’Rex to work with v1.5.7B, so I also used v1.0.5r2 for those boards.  If I wasn’t so heavily invested in this board, I’d scrap it.
  • A kill switch lets me test with peace of mind.  Scout tends to like to drive into the road at times.  At 7 MPH, it can outrun me, so I needed the ability remotely halt the autonomous program.  This feature saved me on many occasions.
  • Rather than use some approach to manually enter the target coordinates, I thought it would be best to just let Scout do that as part of his start-up routine.  Scout saves it in memory until the target is reached or the board is reset.
  • It’s easy to over-steer, especially at high speeds.  I started with a rudimentary PID algorithm, and added some logic to slow down as I approached the target.  I may need to graduate to a proper PID function to optimize the path.
  • Debugging and re-writing code outside is difficult.  Most laptops (mine included) do not work well in direct sunlight.  I found testing on my driveway worked best so I could go into the garage to tweak the code as needed.
  • If I’m traveling at < 5 MPH, how often do I need to re-check my GPS coordinates?  Since the GPS sometimes gives errors, checking too often could result in over-steering or wild goose chases.  I’m still trying to find the right balance.
  • The math required to determine distance and heading to target made my head spin.  After going down several wrong paths, I finally found a formula that seemed to work.  Heavy geometry computations required:

float GPS_MTK_Class::bearing2(float from_latd, float from_lond, float to_latd, float to_lond)
{
// calculate bearing in degrees east of north
// North latitudes and West longitudes as positive and South and East negative
float DX, DY;
float angle_rad, angle_deg;

DX = to_lond – from_lond;
DY = to_latd – from_latd;

angle_rad = atan2(DY, DX);

angle_deg = rad2deg(angle_rad);

return fmod(angle_deg + 360.0, 360.0);
}

  • I found this handy tool for giving the Long/Lat of any place on the globe.

Next Steps:

  • Install the ultrasonic sensors and add logic for obstacle avoidance
  • Add PID for steering
  • Adjust the Pixy to accommodate outdoor lighting
  • Test, test, test
Advertisements

1 Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s