I've been collecting ideas for building a __[Mars Rover]__. This can easily cost a few thousand dollars and I'm not quite sure yet that I'm willing to fund such a venture, but it's fun to dream (and plan).

Apparently lots of people have been inspired by the NASA Mars rovers, as there's lots of projects out on the Web. NASA has even created an "open source" robot project, with downloadable plans.

I recently came upon a JPL paper that goes into quite a lot of detail about the software controllign the Mars Exploration Rovers (MER), Spirit and Opportunity*. These were the two rovers that landed on Mars in 2004 and ran until 2010 and 2018  (resp.), a very long time past their planned mission of 90 days. This is probably the most detailed description I've found of a NASA rover's software.

* ''[The Mars Exploration Rover Surface Mobility Flight Software: Driving Ambition|https://www-robotics.jpl.nasa.gov/publications/Mark_Maimone/biesiadecki_maimone06.pdf]'' \\ Jeffrey J. Biesiadecki and Mark W. Maimone, Jet Propulsion Laboratory, Pasadena, CA USA \\
   [https://trs.jpl.nasa.gov/bitstream/handle/2014/40221/06-0060.pdf] (alternate link) \\
   [https://ieeexplore.ieee.org/document/1655723]  (if you are an IEEE member)

The paper's abstract is:
%%blockquote
   In this paper we describe the software that has driven these rovers  
   more than a combined 11,000 meters  over the Martian surface,
   including its design and implementation, and summarize current  
   mobility performance results from Mars.
%%

__ Contents __

# Introduction
# MER Flight Software Architecture
# Mobility Manager Software
# Low-Level Driving
# Autonomous Driving
#* Primary Autonomous Capabilities
#* Terrain Assessment Overview
#* Robust Stereo Image Processing
#* Terrain Assessment

Another related document from the same team is Chapter 3 of "Intelligence 
for Space Robotics":

* ''Surface Navigation and Mobility Intelligence on the Mars Exploration Rovers'', \\ Mark Maimone, Jeffrey Biesiadecki, Edward Tunstel, Yang Cheng, Chris Leger, NASA Jet Propulsion Laboratory, USA \\ [https://www-robotics.jpl.nasa.gov/publications/Mark_Maimone/05_Chapter3_final.pdf]

This also goes into the mechanics of the rocker-bogie suspension, use of sensors, basic mobility and control modes, autonomous navigation, path selection, etc.

If one were to use a stereo camera like the [RealSense T265|RealSenseT265] (rather than motor encoders) for odometry, here's a paper by, again, some of the same authors: 
 
* ''[Two Years of Visual Odometry on the Mars Exploration Rovers|https://onlinelibrary.wiley.com/doi/pdf/10.1002/rob.20184]'' \\ Mark Maimone, Yang Cheng, and Larry Matthies, Field Report, \\ Jet Propulsion Laboratory, California Institute of Technology, Pasadena, CA

Admittedly, that one is way over my head, but interesting.


!!! Design Notes

[{Image src='attach/MarsRover/Open_Source_Rover_Patch.jpg' link='attach/MarsRover/Open_Source_Rover_Patch.jpg' caption='Open Source Rover Patch (click to enlarge)' width='120' align='right' class='imgFloatRight'}]

So far I've been scanning the cool robot parts at [ServoCity|https://www.servocity.com/motion/] for ideas for the steering mechanism and rocker arms. The scale and weight of the overall robot help decide the size/power of the motors and servos. It's a bit of a balancing act. I also want to, unlike most of the "civilian" designs, somehow tuck my motors inside the wheels or otherwise not have them hanging down near the ground as many/most of the rovers I've seen seem to do. 

I'm likely to try to build a rover a bit smaller than some I've seen on the Web — but not toy size — something using the same motor controllers I've used on my other robots, maybe 22mm or 25mm diameter motors with stall currents around 5 amps. The next step up from there and we're talking much larger motors, beefier controllers, larger batteries, etc. ''Too large'', especially for my budget.

[{Image src='attach/MarsRover/km01-design.png' link='attach/MarsRover/km01-design.png' caption='Preliminary Desing (click to enlarge)' width='300' align='left' class='imgFloatLeft'}]

There's a huge impact on ground clearance if your motors are down there banging into rocks and such. The difficulty seems to be locating some suitably deep wheels. I can't imagine simply 3D printing them, as plastic wheels wouldn't last very long on rocks or concrete. I want a robot that can ''actually roam outdoors''. Also, unless the motors have durable ball bearings protecting the shafts, there needs to be some significant insulation between the motor shaft and the shocks that the wheels will create as they go over rough surfaces. Unless the robot is only going to run indoors, and then what's the point?!

__The basic idea is this:__ six wheels, all 180-200rpm ~25mm high power motors with shaft encoders. The two center wheels are driven but not steerable. The four corner wheels are mounted on ServoBlocks so they can be steered. Rather than a Rocker-Bogie, we opt for the simpler Triple-Rocker. This requires two identical rockers on the sides and one almost-the-same rocker arm at the back, each with dual ball bearing mounts. There are no differentials or connections between the rockers (as in the Rocker-Bogie design).

There will be three pairs of motors, three dual motor controllers, and three batteries. Basically three entirely isolated electical systems, with two I²C isolators between so that there is a common I²C communications between the three, with the center control system the master. The front and back motor/controller pairs (with the steering) are effectively identical. The central system won't have the steering, so that's where we'll mount the controller (likely a Raspberry Pi) and the rest of the sensors.

\\

----

!! Motor Options

I've found three potential suppliers of motors. It's unclear exactly at this point what my unloaded speed (RPM) and torque (oz-in or kg-cm) should be to support the robot at a reasonable target velocity. The NASA Mars rovers move very slowly, for reasons due to the communication distance to and from Mars, caution (no repairs possible), etc.  I'd like the new robot to have roughly the same top speed as the KR01, so I'm basing the new spec on that of the 9V OSEPP 25mm DC motors, about 60m in length, with 8500RPM motors geared down 45:1 to 189RPM. I can't find a torque rating but we'll assume that a motor in that ballpark or maybe a bit stronger would be okay. I'll have to do some tests on the KR01 to actually measure its top speed. 

ServoCity sells an off-road style robot kit called [The Warden|https://www.servocity.com/warden/] which uses the 4.3 inch off-road tires and is roughly the same size as the planned rover, and it's using four of the 195RPM Precision Planetary Gearmotors that I've ordered, so hopefully this is an indication that my choice isn't too far off.

So the options I've found so far are, noting that the ''actual'' motor choice remains to be determined:

%%(font-size:x-small)
__Notes__ \\
The motors should be either 9V or 12V as I'll likely be running off a 12V battery. They'll need built-in encoders. Only the ServoCity motors have ball bearings on the output shafts, the rest are (likely) bronze bushings. The OSEPP is included for reference only, as the encoders require a specialised mount that will be impossible in this robot and are only sold as a kit with a wheel and tire. Published torque ratings are suspect in some cases, posted as published. ServoCity specs are more precise than represented here (e.g., gear ratio and encoder CPR are to three decimal places).
%%

%%(font-size:smaller)
|| Description || Length || Shaft || Voltage || RPM || Gear Ratio || Stall Current || Stall Torque || Encoder CPR || Price (US$) || Notes 
| [OSEPP DC Motor-25 Wheel Kit|https://www.osepp.com/mechanical-parts/124-dc-motor-25-wheel-kit] | 59mm | 4mm | 9V | 185 | 45:1 | | 1.5Kgf.cm | 494 | $19.99 | problematic encoder mount; comes with wheel and tire 
| [47:1 Metal Gearmotor 25Dx67L mm HP 12V with 48 CPR Encoder|https://www.pololu.com/product/4845] | 66.5mm | 4mm | 12V | 210 | 45:1 | 5.6A | 12 kg-cm | 2248 | $36.95 | 25mm diameter, bronze bushing output shaft
| [ServoCity 195 RPM Premium Planetary Gear Motor w/Encoder|https://www.servocity.com/195-rpm-premium-planetary-gear-motor-w-encoder/] | 64.8mm | 4mm | 12V | 195 | 61.6:1 | 4.9A | 6.8kgf-cm | 740 | $31.99 | 22mm diameter, ball-bearing output shaft 
| [ServoCity 5202 Series Yellow Jacket Planetary Gear Motor|https://www.servocity.com/5202-series-yellow-jacket-planetary-gear-motor-50-9-1-ratio-117-rpm-3-3-5v-encoder/] | 132.8mm | 6mm | 12V | 117 | 50.9:1 | 9.2A | 250kg-cm | 356 | $31.99 | ball-bearing output shaft
| [ServoCity 165 RPM HD Premium Planetary Gear Motor w/Encoder|https://www.servocity.com/165-rpm-hd-premium-planetary-gear-motor-w-encoder/] | 106.8mm | 6mm | 12V | 165 | 51:1 | 20A | 49kgf-cm | 2443 | $47.99 | 32mm diameter motor, likely larger than necessary
%%


!!! Progress So Far...

I've analysed the various options but am not convinced of a suitable set of components, so I've ordered the parts for __1/6th of the drive system__: i.e., one motor, several wheel/tire options, a steering servo with mount, a bearing assembly for a rocker arm, and an assortment of possible structural hardware to put it all together. The ''shipping charge'' for the order was US$120. Ouch. I'll probably blog about things when the parts come in and I've had some time to play.

[{Image src='attach/MarsRover/osepp-tank-wheel.jpg' link='attach/MarsRover/osepp-tank-wheel.jpg' caption='A "Tank Wheel" (click to enlarge)' width='300' align='right' class='imgFloatRight'}]

One of the wheel options purchased from ServoCity is a [Round Baseplate|https://www.servocity.com/round-baseplate/], a 0.125" (3.175mm) thick aluminum disk with holes drilled in it in a pattern that allows it to be mounted directly to a motor shaft. At 3mm thick, it's likely strong enough to form the end plate of a Mars rover-style wheel. The cylinder could be made from a durable plastic, aluminum or stainless steel tube, with an outer later of rubber or even OSEPP tank treads (see below). How the cylinder would be attached to the base plate remains to be seen, but this is part of the experiment.
 
I've got a lot of extra OSEPP tank treads since I didn't use any of them in my KR01 robot, which was based on an OSEPP Tank Robot kit. And because a number of the tread pieces had torn or weren't molded correctly, OSEPP had sent me an extra set of treads. As you can see in the photo, the silicon tires fit onto the red aluminum wheels, but it's also possible to wrap the wheel in the treads pieces since the wheels were (when part of the Tank kit) meant to hold the tank treads. I got lucky that the number of tread pieces just fits onto the wheel. 

Similarly, if I can find a suitable piece of possibly 4" tube it might be possible to wrap three rows of treads around it, with each tread being 30mm wide this would give me a 90mm wide wheel with a diameter of around 120mm. That's enough to tuck my motors inside the wheels, as in the Mars rovers. If I ended up with wheels that large I might consider using a higher gear ratio, slower motor. Five inch wheels is bigger than I'd imagined. There's clearly some experimenting to do if I decide not to use a commercial (e.g., robot or off-road hobby car) wheel.

* [Replica Mars Rover Curiosity outside the lab... exploring the real world...|https://youtu.be/rZESgtjL0B0] YouTube video of scale model of NASA Mars Rover using ServoCity Actobotics parts, Pololu motors, etc.  Built by [Carlos Sicilia Til|https://www.youtube.com/channel/UCIgnjQmL78DlHMuank2THLg] who indicates his servos as: 4kg.cm wheel servo.  Arm servos: 25kg.cm at shoulder, 4kg.cm at elbow and 1.5kg.cm at tool holder.
     



! Rocker-Bogie vs. Triple-Rocker Design

The ExoMars (and ExoMy) robot uses a simpler "Triple-Rocker" design.

!! Someone-Else's Specifications

I'm going to (initially) steal the specs from the JPL Open Source Rover Project, as a point of reference. Their robot is a bit larger than I'm planning and has an estimated cost of around US$2500, and that's certainly at the upper limit of my budget. But it's a start.

%%(width:90%;margin-left:4em;font-size:smaller)
||Attribute||Value [[imperial]||Value [[SI]
|Weight|28 [[lbs]|12.7 [[kg]
|Footprint|24x14 [[in]|60.96x30.48 [[cm]
|Battery Capacity|5200 [[mAh]|5200 [[mAh]
|Battery Discharge Rate|8 [[A]|8 [[A]
|Nominal Current Draw|1.2 [[A]|1.2 [[A]
|Operating time|5 [[hrs] (continual use)|5 [[hrs] (continual use)
|Approximate Max speed|68.8 [[in/s]|1.75 [[m/s]
|Maximum 90 deg vertical scale|12 [[in]|30.48 [[cm]
|Maximum height differential between sides|14 [[in]|35.56 [[cm]
|Communication (in this guide)|Bluetooth app (Android only) and Xbox Controller| 
|Cost (*)|~ $2,500| 
%%

!! Initial Specifications
 
%%(width:90%;margin-left:4em;font-size:smaller)
| Qty | Item | Unit Price (NZ) | Price (NZ) |  | Vendor | Reference
| 3   | ThunderBorg motor controller | $73.00 | $219.00 |  | PiBorg | [https://www.piborg.org/motor-control-1135/thunderborg]
| 6   | wheels | $30.00 | $180.00 |  | misc |
| 6   | 47:1 Metal Gearmotor 25Dx67L mm HP 12V with 48 CPR Encoder | $53.00 | $318.00 |  | Pololu | [https://www.pololu.com/product/4845]
| 4   | steering assembly: ServoBlock, servo mounts (est.) | $42.72 | $170.88 |  | ServoCity | [https://www.servocity.com/standard-hub-shaft-servoblock-25t-spline/]
| 4   | 2000 Series Dual Mode Servo (25-2) | $47.00 | $188.00 |  | ServoCity | [https://www.servocity.com/2000-series-dual-mode-servo-25-2/]
| 3   | rocker assembly (est.) | $50.00 | $150.00 |  | ServoCity/misc |
| 1   | Adafruit 16-Channel PWM / Servo Bonnet for Raspberry Pi | $14.19 | $14.19 |  | Adafruit | [https://www.adafruit.com/product/3416]
| 3   | Makita Battery Li-Ion CXT 12v 4.0Ah  | $136.56 | $409.68 |  | Toolshed Petone | [https://www.thetoolshed.co.nz/product/8478-makita-battery-li-ion-cxt-12v-4-0ah]
| 2   | 12V max CXT® Power Source w/ USB port (YL000000003) | $95.00 | $190.00 |  | Toolshed Petone | [https://www.makitatools.com/products/details/YL00000003]
| 1   | Raspberry Pi 3 - Model B - ARMv8 with 1G RAM | $35.00 | $35.00 |  | Adafruit | [https://www.adafruit.com/product/3055]
| 5   | Pololu Carrier with Sharp GP2Y0A60SZLF Analog Distance Sensor 10-150cm – 3V | $18.47 | $92.35 |  | Pololu | [https://www.pololu.com/product/2474]
| 2   | Adafruit ISO1540 Bidirectional I2C Isolator - STEMMA QT / Qwiic | $12.76 | $25.52 |  | Adafruit | [https://www.adafruit.com/product/4903]
| 1   | chassis (est.) | $50.00 | $50.00 |  | misc
|     | Total (not including shipping) |  | $2,042.62
%%



!! Links

* [Mars Exploration Rover|https://en.wikipedia.org/wiki/Mars_Exploration_Rover] on Wikipedia
* [JPL Open Source Rover Project|https://github.com/nasa-jpl/open-source-rover] on github
* [NASA Open Source Rover|https://opensourcerover.jpl.nasa.gov/#!/home]
* [NASA's Rover Page|https://mars.nasa.gov/mars2020/spacecraft/rover/]
* [The Mars Exploration Rover surface mobility flight software driving ambition|https://www.semanticscholar.org/paper/The-Mars-Exploration-Rover-surface-mobility-flight-Biesiadecki-Maimone/e84d3a62d4de4c59b8a2525bc797e02665055728?p2df], JPL paper ([alternative link|https://www-robotics.jpl.nasa.gov/publications/Mark_Maimone/biesiadecki_maimone06.pdf])
* [Raspberry Pi Zero or Microbit M.A.R.S. Rover robot £120|https://www.geeky-gadgets.com/raspberry-pi-robot-15-09-2020/], a brief review of 4Tronix [M.A.R.S. Rover Robot for Microbit or Pi Zero|https://shop.4tronix.co.uk/products/marsrover?variant=31848857043059] (there are variants for the Raspberry Pi Zero or Micro:Bit)
* [Yuri 3 rover|https://www.raspberrypi.org/blog/yuri-3-rover-the-magpi-82/] (The MagPi #82), describes the Yuri 3 mini Mars rover, which was designed by Airbus engineer John Chinner
* [Build your own NASA Curiosity rover|https://www.raspberrypi.org/blog/build-nasa-curiosity-rover/] from the Raspberry Pi Blog 
* [Students Can Now Build Their Own Rover Model|https://www.jpl.nasa.gov/news/students-can-now-build-their-own-rover-model] (JPL)
* [Design and Analysis of a Four Wheeled Planetary Rover|http://library.iyte.edu.tr/tezler/master/makinamuh/t000341.pdf], Masters Thesis, Matthew J. Roman, Norman, Oklahoma 2005 (PDF)
* [Rocker-Bogie tagged articles|https://hackaday.com/tag/rocker-bogie/] on Hackaday
* ''Give your Robot the Mobility Control of a real Mars Rover'', by Bill Marshall (DesignSpark):
** [Part 1|https://www.rs-online.com/designspark/give-your-robot-the-mobility-control-of-a-real-mars-rover-part-1], covers the theory behind PID control
** [Part 2|https://www.rs-online.com/designspark/give-your-robot-the-mobility-control-of-a-real-mars-rover-part-2|https://www.rs-online.com/designspark/give-your-robot-the-mobility-control-of-a-real-mars-rover-part-2], discusses the practical issues of odometry and using PID for precise mobile robot navigation
** [Part 3|https://www.rs-online.com/designspark/give-your-robot-the-mobility-control-of-a-real-mars-rover-part-3], look at some more code and other features of practical rover design
** [Part 4|https://www.rs-online.com/designspark/give-your-robot-the-mobility-control-of-a-real-mars-rover-part-4], Wheeled robots take many forms: 2-, 3-, 4-, 6- or 8-wheels, with and without suspension. The type of terrain the robot will move over largely determines the choice: a nice, smooth warehouse floor or a rough, unpredictable Martian surface?


! Rover Examples

[{Image src='https://raw.githubusercontent.com/jakkra/Mars-Rover/master/.github/driving.gif' link='https://github.com/jakkra/Mars-Rover/blob/master/.github/driving.gif' caption='Mars Rover by Jakob Krantz' width='300' align='right' class='imgFloatRight'}]

* [NASA, Raspberry Pi and a mini rover|https://www.raspberrypi.org/blog/nasa-raspberry-pi-and-a-mini-rover/], built by NASA scientist Dr. Jamie Molaro with an estimated cost of US$5333
* [Build a ‘real’ Mars rover|https://www.rs-online.com/designspark/build-a-real-mars-rover], describes building a 4tronix M.A.R.S. rover kit
* [Robot Garden’s Mars Rover|https://forum.makeblock.com/t/robot-gardens-mars-rover/13520]. a 3D-printed robot (YouTube video also [available|https://youtu.be/WmEvipAQbeU])
* [Sawppy the Rover|https://hackaday.io/project/158208-sawppy-the-rover], Motorized model of Mars rovers Curiosity and Perseverance For Under $500 (uses 3D printed parts and extruded aluminum beams)
* [Mars Rover part 1|https://youtu.be/kuLRMul_Pxo] by Peter Ohlmus
* [The Open Source Mars Rover, One Year Later|https://hackaday.com/2020/07/02/the-open-source-mars-rover-one-year-later/] on Hackaday, uses LoRa to communicate with the (human) controller, with [open source code|https://github.com/jakkra/Mars-Rover] on github; he uses a separate 12v-5v switching voltage regulator for each servo (!) and outlines the hardware in more detail on the github page



----
[{Tag MarsRover}]