Building a 3-D Printed Robot – Part 2

In my last post, I described this project and how to get the Raspberry Pi set up and tested.  This post continues with getting the Robot Operating System installed and working and getting a few parts selected and ordered.

Why use the Robot Operating System?

The Robot Operating System (ROS) is a framework to build advanced robots using Python, Lisp or C++.  I elected to go with the ROS because of it’s long list of prebuilt capabilities (e.g. vision and navigation) and extensibility.  The framework provides a way to create a publish/subscribe messaging and services infrastructure that can span multiple controllers and computers.  Robot components are controlled through specialized code running in ROS Nodes.  ROS Nodes interact with each other through a server node controlling the overall infrastructure.  A multiple controller design can communicate over a local WiFi network or be contained entirely on a single controller.  I am still learning about this framework and currently plan to run everything on the Raspberry Pi with Python and use my laptop as a development, monitoring and debugging node.  As I learn more about the performance characteristics, I will have the option to move work off of the Raspberry Pi to other controllers or convert the Python to C++.

Installing the ROS

I would like to have the ROS on my Mac as well as the Raspberry Pi.  The ROS Indigo distribution is fully supported on Ubuntu but only experimentally on the Mac.  I elected to use VirtualBox to run Ubuntu on my Mac:

  1. Installed Ubuntu with VirtualBox on the Mac using these instructions.  Note that ROS Indigo supports Ubuntu 14.04 “Trusty Tahr”.  This was a very easy install and worked without a problem.
    • I updated the Network Settings of the Ubuntu VM by selecting the Network tab and changing the Attached to: option to use Bridged Adapter.  This will enable the VM and Raspberry Pi to reach each other (e.g. ping, ssh).  This setting may be revisited depending on experience.
    • I made the Ubuntu desktop full screen.  This was a side effect of using the VirtualBox menu on the running desktop: Devices … Insert Guest Additions CD image …
  2. Installed ROS Indigo on Ubuntu using these instructions on the ROS site.  I went through all of the beginner tutorials to ensure the installation worked.  This was also straightforward with no issues.
  3. Installed ROS Indigo on the Raspberry Pi using these instructions on the ROS site.  A few problems came up:
    • Much of the installation is actually a build from source code.  This process took many, many hours – the better part of a full day.
    • The build from source for the liburdfdom-dev package failed because it was unable to find the requested Boost Library version 1.55.0.  I manually installed the lib-boost-thread-dev and lib-boost-system-dev libraries using apt-get install.
    • The GUI-based turtle tutorials were not tested because I was remotely accessing the Raspberry Pi via ssh.  I have not gone back and connected a monitor and keyboard to the Raspberry Pi to confirm they work.
    • I was able to confirm the rest of the tutorial by running the pub/sub example.
  4. I was able to get the Ubuntu VM to run the main server (roscore) and the publisher example while the Raspberry Pi successfully subscribed and received the messages on the same topic.

Next Steps for Set-Up

I’d like to get a Python IDE working that can easily work within the ROS package directory requirements.  The Adafruit WebIDE is great for beginners but there appears to be challenges getting the source tree assumptions aligned with the ROS package source assumptions.  I may be able to use a symbolic link from the ROS src directory to the WebIDE directory to make that work.  Alternatively, I am exploring the use of LiClipse on Ubuntu working against the source tree mounted on the Raspberry Pi MicroSD card.

More Parts!

I’ve been waiting for HobbyKing to deliver the HK15298 servos for the arm and it’s been a frustrating experience.  The servos are now backordered (even though they appear to be in stock at a different US warehouse) and after a long delay and terrible customer service, the servos have been canceled.  I have selected a substitute that I think should work: Power HD High-Torque Servo 1501MG.  The 1501MG has slightly more torque at 6V and equivalent turn rate.  It is not high voltage and it is not digital but those features should not matter for this application.

On the 3D printed parts front, I have decided not to get my own 3D printer.  While it sounds cool to have your own 3D printer, the ABS plastic smell, printing noise and the need for a temperature controlled room eliminated that option for me.  Instead, I am using 3D printing services like www.3dhubs.com.  I found a local engineering company that has many great reviews and ordered all 28 parts for the right hand and forearm.  The parts are done and being shipped in the next few days.

 

Building a 3-D Printed Robot – Part 1

This is the most ambitious personal project I have attempted.  I plan to build a version of the InMoov robot and document my experiences here.DSC_0036bis2-682x1024  The InMoov is the creation of French sculptor Gaël Langenvin. Gaël has generously contributed the design as open source (for non-commerical use) including all of the 3-D design files and code.

The original design utilizes two Arduino processor cards and a Windows computer running MyRobotLab.  I want to utilize the open source Robot Operating System to leverage the advanced architecture and existing features. I really like the ability to scale the use of additional heterogenous controllers throughout the robot while using the ROS. In order to use the ROS, the robot needs to run a version of Linux.  This led me to decide to use a Raspberry PI 3 running Raspbian (Jessie) as the main processor.  This latest version of the Raspberry Pi has some pretty impressive specs for such an small and inexpensive controller including quad core 64 bit processor, 1 Gig of memory, built in wifi and bluetooth, Micro SD card slot, 4 USB ports and HDMI to name just a few.

To get started, I plan to first build the right forearm and hand.  Because I am starting with a processor and operating system that is different from the InMoov project, I plan to start small and build incrementally.

Getting the Raspberry Pi 3 OS Installed

After I received the the Raspberry Pi 3 (see the parts list below), I wanted to first verify that I could get the Raspbian operating system properly installed.  This turned out to be very easy thanks to the excellent download and set-up instructions on the Raspberry Pi web site.  I used a 16G Micro SD card I had on hand along with a bluetooth mouse, USB keyboard and HDMI display to boot NOOBS and install Raspbian.  The ROS is rather large, so a 16 Gig Micro SD card seemed prudent.  In very little time, I had the full desktop up and running. Afterwards, I learned of a innovative product called pi-top that turns your Pi into a laptop with integrated display, keyboard and mouse.  This might be a good way to do standalone development on the Pi, although as you’ll see later, I found a wireless alternative.

Connecting a Servo

I had a very modest second step of getting a single servo to work with the Pi.  There will be 28+ servos in a completed robot, so I thought I better figure out how to make those work right away.  As a design principle, I decided to try to reserve the central Pi processor for high level functions and leave hardware protocol handing (e.g. such as pushing pulses to control servos) to other controllers.  After some research, I selected the Adafruit 16-Channel 12-bit PWM/Servo Driver – I2C interface – PCA9685 because it off loads the pulse modulated width handling off of the Pi and uses the I2C interface to minimize the use of GPIO pins.  It can handle up to 16 servos and additional boards can be chained together to support up to 992 servos.  Yeah. That should scale just fine.  This board requires soldering about 40 pins to make the connections.  I also needed a way to connect the GPIO pins on the Pi to the servo driver board.  I got a Pi T-Cobbler Plus – GPIO Breakout to do that.  I used a servo I had on hand and these instructions to connect everything.

Configuring the Pi

For this design, I had to enable and configure wifi to connect to my local network and enable the I2C interface. I verified the wireless connection by opening the web browser included with Raspbian and connected to a website.  I used these instructions to enable and verify the I2C function and servo board connection.  I also changed the default password for remotely accessing the Pi.

Running the Code to Move the Servo

When I used the Pi with a monitor, keyboard and mouse I found the response time to be sluggish.  I couldn’t see myself doing development work in that kind of environment where you want very fast response and build times.  The ultimate solution would be to set up a cross-compile tool chain so that I can develop and build code on my Mac and deploy it to the Pi.  This looks to be a complex process and so I elected to take a simpler approach.

Many Pi developers use the command line editors like nano or vi.  I wanted something a bit more capable and came across the Adafruit WebIDE.  This free tool runs as a server on the Pi and enables you to use a browser-based IDE on your computer to develop, build, test and debug your code. It uses a local GIT repository on your Pi to hold your code and backs it up to a BitBucket account.

I was able to run the Adafruit example Python code to test the servo without much trouble.

Next Up: Installing the Robot Operating System

Parts List
  1. [$40] Raspberry Pi 3 – Model B – ARMv8 with 1G RAM
  2. [$8] Assembled Pi T-Cobbler Plus – GPIO Breakout – for RasPi A+/B+/Pi 2/Pi 3
  3. [$15] Adafruit 16-Channel 12-bit PWM/Servo Driver – I2C interface – PCA9685