ROSCar - A rover test platform with Raspberry Pi, Ubuntu, ROS and OpenCV

ROSCar - A rover test platform with Raspberry Pi, Ubuntu, ROS and OpenCV

TL;DR

This is yet another Raspberry Pi Rover project, which depends on camera as major visual input and uses ROS (Robot Operating System) as software framework. With ROS, I can concentrate on individual algorithm design, but not to worry about communication among all components. You can find my codes in github.

Introduction

This project is to build a rover as a primitive platform where I can do tests, including lane detection, line following, object avoidance, SLAM, etc. Similar projects can be found cross internet, however, I want to focus on the software infrastructure in the project. Most similar projects put all codes in single modules, then pass data via function parameters or shared files. To begin a new project, makers have to copy old codes and build another modules again, and they may have to deal with date sharing again, which more new codes are necessary. For one-time test or small project, that may just work fine. However, if I want to use it as a long-term test platform, those are what I want to get rid of.
roscar system

Goal

This rover project runs on a Raspberry Pi with camera to be the eye of this rover. C/C++ is the major language and ROS (Robotics Operating System) as the framework. A cheap two-wheel chassis kit (with geared DC motors) is used in the first stage. An external 12v power supply is adopted to power RPi and DC motors. A voltage converter is used to get 5v to power RPi. With this configuration, I test a "Line-following" algorithm and a "Lane-detection" algorithm, so this rover can run by following single track or a lane.
Thanks to ROS, I can focus at algorithm implementations, and leave all those communication protocols behind. In my project, image is acquired via Pi Camera vis ROS usb_cam package, then converted to OpenCV format via ROS cv_bridge. This image goes to my algorithm filter, which find track and lane, the output is track direction. This track direction is converted to "suggested" motor direction, and publish to motor-controller vis ROS topic (cmd_vels.) Once receive cmd_vels, the motor controller applies PID-control and set the speed and direction to two dc motors, which control the movement of the rover. The motor controller use "wiringPi" library to send PWM signal to control speed of dc motors. All program run on one Raspberry Pi, which is managed via ssh client from other laptop linux box. The output message and image are re-direct to this linux box.

Hardware items

  • Raspberry Pi 2 model B
  • L298 motor driver module
  • DORK LM2596 voltage converter
  • Raspberry Pi Camera
  • Wi-Pi 802.11n USB dongle
  • 12V external power pack
  • Two-wheel chasis kit with geared DC motors
  • A breadboard for easy connection
  • Full view
    Front view
    Raspberry Pi2 with Wi-Pi. Pi Camera is mounted inside the white cylinder object.
    Rear view
    12v power pack (blue object) and a breadboard for easy wire connection.
    Base view
    2 dc motors, motor controller, voltage regulator and one free-wheel.
    Base view - closeup
    LH298 motor controller and Dork voltage reducer
    Top view
    Side view
    roscar on the track
    roscar on the track

Software

Test environment
I do all tests in my garage with uneven light sources, mixed with sun light (from windows) and fluorescent light. I lay white duct-tape on concrete floor as tracks, which is 1.8-inch as width. For lane-detection, lane is 16-inch as width, and edged by same white duct-tape.

Summary

This is an overview to my test platform, so far, this rover can do line-following and lane-detection. All are tested with a well-controlled environment. With ROS, I can just do algorithm coding but not to worry about network/communication protocols. Details of this project will be published to my blogs, and all my codes can be found in my github.

ToDos

  • To create an Android app and Web-frontend as controllers and console.
  • Add laser scanner for SLAM.
  • Better wheel base and DC motor control algorithms.
Last modified on Wednesday, 27 January 2016 11:18

© Copyright 2007- Yi Systems, Inc. All rights reserved.

5009 Asteria St, Torrance, CA, 90503, U.S.A. | +1-310-561-7237 | requestinfo@yisystems.com