Leo Rover Mast

This tutorial shows how to 3D print and integrate with Leo Rover camera mast addon.


In this tutorial we will show you how to build and integrate another addon with Leo Rover - Camera Mast.
It is inspired by camera mast built on top of NASA's rover Opportunity and is able to rotate camera through an angle of 360 degrees, more than 270 mm above the top of the Rover!
Motors that are used for this application are Dynamixel AX-12A servo's which provide feedback, are quite easy to control with usage of ArbotiX and are in decent price. If you have an access to a 3D printer, everything you need to build this addon is really easy to get and no special knowledge is needed. We will get through creating G-codes for 3D printer, assembling everything and at the end integrating it with Leo Rover.


List of materials

  • 3D printed parts
    • 01126v2 (Base)
    • 01127 (Main tube)
    • 01129 (Second servo mount)
    • 01130 (Second servo cover)
    • 01125 (Rotation shaft)
    • 01131 (Third servo mount)
    • 01132 (Camera mount)
    • 2x 01133 (Bearing shaft)
    • 01134 (ArbotiX mount)
  • 3x Dynamixel AX-12A - (link)
  • 3x Dynamixel cable (link)
  • ArbotiX-M Robocontroller (link)
  • FTDI USB-UART cable or FTDI converter (5V)
  • miniUSB (male) - USB (female) adapter
  • 2x 6800Z ball bearing (dimensions -> 19x10x5 mm)
  • 52x40x7 mm ball bearing
  • 8x M3 nut
  • 4x M3 square nut
  • 4x 2,2x6,5 screw
  • 8x M3x10 hex bolt with button head (actually any M3x10 will be okay)
  • 8x M3x6 hex bolt with button head (actually any M3x6 will be okay)
  • 4x M3 brass inserts
  • 2x M3x10 hex bolt with head cap (ISO 4762)
  • 26x M2x8 hex bolt with head cap (ISO 4762)
  • 26x M2 nut

3D printing

You can get all of the needed files here:
As at our company we are using Prusa 3D printers, we will show how to prepare 3D models for printing using their software - PrusaSlicer. This application will provide a special file for the printer (G-code) which tells the machine what are the settings and how it should move to create our model.
PrusaSlicer layout
First thing we need to do is to import our files to the application. Click on the Add button (box with a plus sign at the top of the screen) and select the files you want to add.
After uploading the files, it should look like this:
Now we need to spread the models in order to avoid interference. To automatize the process, press the Arrange button (on the right from bin icon).
The arrangement is still not perfect. Our goal is to minimize the number of walls that are "levitating" in the air to avoid support constructions that needs to be printed. Here are some hints for positioning components:
  • Minimize support constructions - it brings a lot of advantages:
    • shorter printing time,
    • less post-processing,
    • smaller amount of used filament,
    • better quality of print.
  • Try to use big flat surfaces as base to increase adhesive area.
  • If some places in component are critical (ex. bearing housing, round holes) try to put them on the top of the print.
By using the buttons on the left, we can rotate and change position of every component. As you can see, we need 2 pcs of Bearing shaft (01133), so click on this part and press + button to add another instance of this model. When you are satisfied with the orientation of the models, press the Arrange button again for optimal arrangement of components at the 3D printer table.
Now we can move on to the settings. You can go through all the detailed options by clicking on different tabs at the top, but if you don't have much experience in 3D printing, we recommend using system presets.
The presets can be chosen from the panel on the right side and they consist of:
  • Print settings They affect the layer height, printing speed and quality of the printed model. For our need, the fastest option - 0.30mm DRAFT will be enough. If you need a better quality print and you don't care about the printing time, you can choose a more detailed preset.
  • Filament In our case it is Prusament PLA and it is also our recommendation for you. For more sturdy models, you can use ABS but it is much harder in printing - it may peel of the table or the layers may not stick together and you will have to start the print from the beginning.
  • Printer Select the printer you want to use. In our case it is Original Prusa i3 MK3.
  • Supports For this option, we suggest support on build plate only. Printer will handle everything that is inside of the models and we will save some time and material. In case of some problems, you can use support everywhere option.
  • Infill As the material we are using is not so strong, we are using 100% infill. In lower infill settings, the 3D printer will do grid structures instead of full infill.
If everything is set, click on Slice now button.
You can now see exactly how your print will look like. Use your mouse to rotate, move or zoom your preview and the slider on the right side to discover individual layers of the build.
When you'll finish admiring your work, you can click on the Export G-code button that's located on the bottom right corner. Save the file on SD card of your 3D printer, load SD card into your machine and that's it! You can now start printing.
Remember to clean 3D printer table before any print! We recommend IPA for this purpose.


Flat layout of all elements
Step 1: Press ball bearings into 01132 and 01127.
Step 2: Assemble 01127 with 01129 using 4xM3x10 bolts and 4xM3 nuts.
Step 3: Prepare AX-12A servo, 01130 and 10xM2 nuts
Step 4: press M2 nuts into places where there will be bolt connection and assemble servo and 01130
Step 5: Connect 2 cables to the servo. If you have short cables you should extend them. Especially the one which will be going to the upper servo.
Step 6: Route the wire through rectangular hole in main tube
Step 7: bolt together both parts using 6xM2 bolts
Step 8: Assemble servo to the main tube using 4xM2 bolts on one side and M3x10 bolt and bearing shaft on the other. Route cable through rectangular hole
Step 9: Press big ball bearing into 01130.
Step 10: Bolt rotation shaft to the servo using 4xM2 bolt. Make sure that shaft is parallel to the servo horn.
Step 11: Bolt third servo to the 01131 using 8xM2 bolts and plug the cable.
Step 12: Assemble 01131 to the rest of camera mast using 4xM3x10 bolts and 4xM3 nuts.
Step 13: Assemble 01132 to the rest using 4xM2 bolts on one side and bearing shaft and M3x10 bolt on the other side - similar to the first joint.

Integrating with Leo Rover

Now, that you've built the mast, it's time to mount it on the Rover and install all the necessary software.

Mounting and wiring the mast

Camera mast needs 2 things for the operation - a power supply and an additional controller that will communicate with the Rover. The device, that we will use for communication with the servos, is ArbotiX-M Robocontroller, also suggested by Dynamixel manufacturer.
A total of 3 cables need to be connected to the controller - output of the power supply, FTDI USB-UART cable and a Dynamixel servo. To make the mounting easier, we designed a special mount for the Arbotix board that can be attached to the Rover.
Step 1: Screw 01134 (ArbotiX mount) to the top of the rover near antenna. Remember to hot-press M3 inserts earlier.
When the ArbotiX board is safely mounted, we can start wiring the components. Let's start with the power supply. Dynamixel servos are powered with a 12VDC supply, the same as the Leo Rover, so we can power the board from the main battery by soldering a DC barrel jack cable as a second output of the DC-DC converter like in the picture below:
Step 2: Solder the DC connector to a 12V part of the DC-DC converter. For your convenience you can also get this part at our website.
When it is done just plug in the connector to the ArbotiX board.
Double check the wiring before plugging it in! The barrel jack should be center-positive (you can confirm it with a multimeter). The board might not be protected against reverse polarity.
Next step is to connect the ArbotiX board to the LeoRover's miniUSB socket (located at the top) using a USB-UART FTDI 5V converter. We have tested 2 variations of the connection: using SparkFun FTDI breakout board and a male to male miniUSB cable or using FTDI cable and a miniUSB to USB adapter.
Possibility 1: Sparkfun FTDI adapter -> double miniUSB cable
Possibility 2: Standard FTDI cable -> miniUSB to USB adapter
Last step is to connect the Dynamixel cable to any of the 3 sockets that will fit the connector.

Setting servo ID's

In order to properly communicate with the servos, you need to assign them unique ID's. The most common way of choosing the ID is to set 1 for the base joint and increment it by 1 for each next joint in the chain.
Set the Dynamixel ID's like in the image below:
To learn how to do this, you can follow our guide for the Arbotix controller here:

Install the ROS driver package

The leo_mast_bringup package contains a configuration for Arbotix driver as well as a script that provides mast lift and lower operation through ROS services.
You can build it like any other ROS package. Start by creating an empty catkin workspace, if you don't have one yet:
mkdir -p ~/ros_ws/src && cd ~/ros_ws
catkin init
catkin config --extend /opt/ros/melodic
Clone the package into the source space:
cd ~/ros_ws/src
git clone
Install dependencies:
cd ~/ros_ws
rosdep update
rosdep install --from-paths src -i
Build the workspace:
catkin build
Source the result space:
source ~/ros_ws/devel/setup.bash
Now you can use roslaunch to run the driver:
roslaunch leo_mast_bringup leo_mast.launch
If you want the driver to start automatically when the RaspberryPi boots, you can change the overlay in /etc/ros/setup.bash to point at your workspace:
# source /opt/ros/melodic/setup.bash
source /home/pi/ros_ws/devel/setup.bash
Then, add this line to /etc/ros/robot.launch file (between the <launch> tags):
<include file="$(find leo_mast_bringup)/launch/leo_mast.launch">
Apart from the topics and services described in the Arbotix tutorial, you will see two new services: /mast/lift and /mast/lower. The first one will lift the mast to standing position, the second one will lower the mast to the back of the Rover and relax the servo.
You can test these operations with rosservice tool:
rosservice call /mast/lift
rosservice call /mast/lower

Adding a Web UI

We have prepared a sample UI for the camera mast. It is just a simple control panel that demonstrates its capabilities. Don't hesitate to develop your own one and present your project to the community.
To install it on your Rover, follow the tutorial below:
Then, type in you web browser the LeoRover's address and choose the port number (for example If the UI was loaded correctly, you should see the same interface as below: