Introduction: Remote Controlled Tracked Vehicle With Obstacle Avoidance

Welcome to this exciting DIY project where you'll build a fully customizable tracked vehicle platform! This guide is designed for hobbyists looking to dive into robotics and mechanical design. Over the next three days, you'll create a vehicle that's not only capable of traversing uneven terrain like grass with its individual wheel suspension but also capable of taking commands via ROS 2.

This robust platform measures 360mm by 200mm and stands 70mm tall. It features the ability to lift itself and an additional 500 grams up a 45-degree slope, perfect for navigating complex obstacle courses. Plus, you have the option to equip it with a depth camera to map out the terrain it travels.

What sets this project apart is its complete DIY nature—unlike other guides, you'll learn how to build the tracked vehicle chassis from scratch (no buying track or chassis is needed). This project requires basic tools for rapid prototyping, such as a 3D printer, and some familiarity with software setups. By the end of this project, you'll not only have a functional tracked vehicle but also a solid foundation in tracked vehicle design and robotics.

Dive in, and let's start building!

Supplies

1 sheet of 1/8 in acrylic (3ft x 1ft)

2x 150 RPM worm geared Geartisan motors

1x 14.8 V Li-Po battery (no bigger than 4000mAh, else it would not fit)

L298N DC motor controller

2 manual on/off switches (min 4A, 16V)

Arduino UNO R3

3D printer

PLA filament

TPU filament

20x 4mm *30mm bolts and nuts

2x 1/4 x 2in bolts and nuts

Xbox controller

Slamtech RPLIDAR

1x DC-DC transformer CHUANGRUIFA 12V to 5V

Soldering station

Superglue

9V DC circular Jack that goes into the Jetson*

3A fuse and holder*

Nvidia Jetson (ORIN NANO or NANO)*

Intel RealSense Depth camera*

*for the optional mapping and advanced self navigating option



Step 1:

3D print the wheels out of PLA (10% infill, 2 wall layers)

3D print the torsion bars and their spacers out of PLA (100% infill)

3D print 8 of the track segments out of TPU (100% infill)

3D print the hull front (track tensioner) (10% infill, 2 wall layers)

3D print the attachment pieces for the top plate (40% infill, 2 wall layers)

Laser cut all files (top plate, middle plate (for holding motors). back plate, two side plates, and bottom plate. (dxf files)

* i have also provided the files mounts for the RP lidar, if you are using that one

The overall file is also provided in STEP and F3D formats, in case if you want to modify it for your own fit.


Tip: while waiting for 3D prints, you should skip to step 6 to start setting up the Jetson

Design decisions that may be questionable: The pointy nose of the tracked vehicle is an artistic choice, you could make it simpler for convenience. The front track tensioner slot should not be tensioned without the front pointy nose piece, as it is not designed to receive lateral stress. The lack of bearings inside the wheels is for simplicity, as we have 8 road wheels and each wheel does not have significant load for the PLA to rub and melt. Feel free to add bearings to the CAD file I provided below for longevity. The torsion bars could be made thicker if you want them to be stiffer. Be careful: the two sides of the chassis are not mirrored, so make sure do not laser two of the same file - it will not fit. Though we have provided mounts for motors, this intractable does not require any mounting because it is convenient enough to just superglue into the slot, and it works. The track is being driven by a dual sprocket (imagine your bicycle chain but wide). For increased traction, you could solder additional TPU strips onto the track.

Step 2: Assemble the Drivetrain

Assemble the torsion bar transmission, which dampens the motion with the twisting of the bar. Make sure that the bars go in 45 degrees relative to the ground. If the 3d printed piece does not fit ideally, do not worry, just use a knife and work the edges of the bar, that should ensure a tight fit. This should be done together with assembling the bottom plate because otherwise it would be extremely difficult to put in.

1) put the spacer for the mini suspension onto the torsion bars, slide it all the way to the bend place

2) assemble the plates together like the above picture

  • The wheels on both sides are not supposed to be aligned, which is a design feature

Step 3: Assemble the Motors and Their Controllers

The above wiring diagram is the way electronics should be assembled.

For the affordable fun version you ignore the Jetson. Just directly wire the power to the Arduino with a DC-DC transformer (12V to 5V) and 2A fuse (to prevent the Arduino releasing magic smoke). That way you could just program the driving capabilities in Arduino, which is also fun. So instead of having the Jetson power the Arduino, we connect a parallel wire from the battery into the 12V in of the DC-DC transformer, and 5V out into the Arduino.

Step 4: Assemble the Mini Tank

1) Screw all wheels on, where one nut goes on one side of the suspension hole, another nut goes on the other side. You could superglue the nuts if they come off. Make sure do not screw the big road wheel nuts too tight - it runs based on the diameter difference between the wheel and the screw - else it will not turn.

1.5) The rear driving wheel (the double layer sprocket looking thing) has a indentation that matches up with the axle of the motor, it can be put on by pushing. If you are using another motor, just modify the hole on that driving wheel in the CAD file I have provided.

2) Now put the driving wheel on, assemble the front piece, where the larger indentation is made for the standard 1/4 in nut. Then put the wheel on, put the front wheel on, screw another nut on the other side of the screw.

2.5) Put your motor in a convenient for you position, make mounts if needed (if you are using another motor). This motor features a square body which can be directly glued to the bottom plate, you can glue this one right away as it will not affect assembling anything else. Maybe you should solder the wires onto the motors so its easier for later.

3) Measure off the track, cut it, and use a soldering iron to melt the TPU track, "weld" it together". Make it slightly longer so that it goes onto the wheels when the front track tensioner piece is fully slammed back. Then once the TPU track is on, move the front track tensioner forward to gain tension. If the track is not tense it will fall off and not drive.

4) Put all other plates together, do not glue yet, it should be able to keep itself together. Once glued, it would be nearly impossible to make modifications.

*note: Do not put the plate that goes right on top of the motors until the last, that plate would hold the entire robot together, but it is challenging to take off.

*note 2: Every mount hole fits a 1/4 bolt in there, so you could screw any extension on.

Step 5: Arduino Version

This tracked vehicle controls just like your normal Arduino car. A code directly copy pasted would work. If it drives the wrong way, then just switch the motor wires on the motor controller. Here is an example code that allows this vehicle to be able to drive forward, and then perform a tank turn, and repeat. For different speeds, adjust speed value, it goes from 0 up to 255 max.

Step 6: How to Set Up Jetson

There are many tutorials online teaching how to set up Jetson (mini on board computer for mapping and processing)

You should not be using the LiPo Battery to power the Jetson for now, just use a laptop power supply. Know that it works from anywhere 5 - 19V, more will burn it. This will take quite a while, so be prepared :)

Note: you cannot flash the SD card right away even though the tutorial tells you that you can

The only way to do it is to download Linux Ubuntu on your computer and then download SDK manager from NVidia, then flash the Jetpack into the Jetson.

Make sure you do not use a high resolution monitor you may have (4K for example), the poor little Jetson will struggle and make everything extremely laggy. Get something like 1080p if you have an old one.

The rest can be followed with the this video


Step 7: How to Set Up ROS2 HUMBLE

There is detailed documentation regarding this here

Make sure install Jammy Jellyfish, other versions would not work with Jetson.

To start development, we need it to be installed on both the jetson and on you PC which you will code on. (It would be so much more convenient for you to code on your PC and not the Jetson, just transfer the code later)

Install differential driver package, the SLAMTECH Lidar package, the Intel Realsense package, and Gazebo package.

The robot model can be found in the description of the GitHub repo

Source ROS


Step 8: ROS 2 Gazebo Simulation

Here is their website with all the tutorials.

Use the GitHub code for this specific design we have provided above.

Use this build

First source ROS

Use ROS 2 to launch articubot launch_sim.launch.py

This will run the simulation that we made

Step 9: ROS 2 Arduino Communication

To establish communication between Arduino and ROS2 for motor control, you'll need to set up separate packages for each system and utilize a specialized library called "Differential Drive." This library is essential for interfacing the two technologies and is not included by default in the Arduino environment.

Creating the Differential Drive Library

The Differential Drive library contains several pieces of code that collectively enable the control of motors using the L298 motor driver via PWM signals. Here's what the library facilitates:

  • Motor Control: It uses PWM signals to manage motor operations through the L298 driver.
  • Command Conversion: Converts incoming commands into PWM signals for motor control.
  • Serial Communication: Acts as a conduit for ROS2 to send commands to the Arduino, which then controls the motor.

Uploading the Library to Arduino

To get started with the Differential Drive library on your Arduino, follow these steps:

  1. Download the library from its GitHub repository: diffdrive_arduino.
  2. Follow a detailed tutorial on how to upload an Arduino library if you are unfamiliar with the process. This will involve adding the downloaded library to your Arduino IDE and including it in your sketches.

Setting Up ROS2

On the ROS2 side, the setup is already pre-configured to handle inputs from a joystick or a twist multiplexer (twist mux). These inputs are then translated into commands that are sent to the Arduino for motor operation. This setup not only facilitates manual control but also lays the groundwork for future autonomous control functionalities.

By following these steps, you'll establish a robust communication link between ROS2 and Arduino, leveraging the Differential Drive library to control motors effectively.

Step 10: XBOX Joystick ROS 2 Connection

To control your robot's motor using an Xbox controller, you first need to install the joystick module in ROS2 Humble. This module will allow ROS2 to interpret the joystick's inputs and convert them into commands for motor control.

Installation

Follow these detailed instructions to install the joystick module on ROS2 Humble:

  1. Open your terminal.
  2. Ensure your ROS2 environment is sourced correctly.
  3. Use the ROS2 package manager to install the joystick module. Typically, this can be done using apt-get or a similar command, specific to your ROS2 distribution.

Configure the Joystick Settings

Once the joystick module is installed, you need to configure it to work with your specific hardware:

  1. Locate the joystick.yaml file in your project directory.
  2. Edit this file to map the Xbox controller’s inputs to the desired angular and linear velocities. This mapping directly affects how the controller’s movements translate to motor commands.

Running the Joystick Code

With the joystick module installed and configured, you can now run the custom joystick code that interacts with the Arduino setup:

  1. Launch your ROS2 workspace.
  2. Execute the joystick control node. This node uses the settings from joystick.yaml to process the Xbox controller inputs.
  3. The node then publishes these commands, which are formatted to interact seamlessly with the Differential Drive library on your Arduino, controlling the motor as per the joystick input.

This setup allows you to manually control your robot's movements via the Xbox controller, serving as an effective interface between the joystick hardware and your motor control system.

Step 11: Code for Obstacle Avoidance

For effective obstacle avoidance in Gazebo simulations with Nav2, it's important to note that our setup does not include an encoder or accelerometer. Instead, we rely on lidar data to determine the vehicle's relative position and create an obstacle map.

Initial Setup

Begin by launching the robot in the simulation environment:

  1. Launch the Robot: Use the launch_robot.launch.py script to start the robot as usual in the Gazebo environment. This script initializes the robot model and simulation parameters.

Configuring Lidar and Mapping

Next, configure the lidar sensor and set up the mapping processes:

  1. Launch the Lidar Node: Execute the rplidar.launch.py script to start the lidar sensor. This node captures and publishes lidar data necessary for mapping the environment.
  2. Map Generation and Localization: Run online_async_launch.py and localization_launch.py scripts to manage the map:
  • online_async_launch.py generates a virtual map or loads a pre-existing map using the lidar data.
  • localization_launch.py helps position the vehicle within the map and continuously updates the map based on new lidar data.

Enabling Navigation and Obstacle Avoidance

Finally, enable the navigation and obstacle avoidance functionalities:

  1. Visualization with RViz: Start rviz2 to visualize the mapping and navigation data in real-time. This tool helps you monitor the vehicle's movements and the detected obstacles.
  2. Launch Navigation: Execute the navigation_launch.py script to activate the navigation system. This allows the vehicle to move autonomously between designated points while avoiding obstacles detected by the lidar.

By following these steps, you can effectively set up and run an obstacle avoidance system in a Gazebo simulation using Nav2, despite the lack of traditional positional sensors like encoders or accelerometers.