This project walks through different sections both hardware and software for building the Kria Autonomous Robotic Platform (Karp).
The project makes use of different advanced technologies like Xilinx/AMD FPGAs, Vitis-AI 2.0, ROS 2, Odrive motor controller, Velodyne lidar, and more so take a coffee, relax and enter to Karp world, you will end up learning a lot of cool things along the way!
Total robot costs around 3300 EUR to the change 3600 USD. Being the Lidar the most expensive part but having bought it second-hand on eBay we have managed to reduce it to a quarter of the original value. Within this price, it also includes the purchase of the artillery X1 3D printer as well as different materials such as a power supply, crimpers, pliers, etc. that in the future can be used in other projects.
This is not an industrial product but a low-cost first prototype that can change in the future maintaining its low-cost essence. We can see this by comparing it to the price of Carter robot which costs approximately 10000 USD, the majority of which consists of the Lidar (4, 000 USD) new, wheelbase (3, 000 USD), and sheet metal (<2, 000 USD). Somewhat expensive from a maker's point of view.
1. Kria 3D ModelWe started this project by creating a 3D Model of the Kria Autonomous Robotic Platform using FreeCad. FreeCAD is a general-purpose parametric3D computer-aided design(CAD) modeler and a building information modeling (BIM) software application with finite element method (FEM) support. It is intended for mechanical engineering product design but also expands to a wider range of uses around engineering. FreeCAD is free and open-source, available for Linux, macOS, and Windows operating systems.
As you can see in the image above, this is the first design implemented in Freecad and the one that we are going to use next when simulating the robot using ROS 2. Some pieces have been designed during the process and others have been extracted from the internet giving credits to the authors at the end of the project.
The idea is to be able to iterate in the process and be able to improve the design in the future if resources are obtained.
The design will be Open Sourced.
2. BOM, Bill of MaterialsIn this section, we will detail different materials used when building the robot. You can find more information in the next google sheet.
Partsof the structure
- 3030 aluminum profile, 500, 300, and 150 mm
- 3-Way End Corner Bracket Connector
- Nuts, 30s-m6
- L Brackets Connector
- Medium Density Fiberboard (different sizes for top and bottom)
- gloss transparent color methacrylate plates
- Alex model 2-1394 Wheel
3D Printed parts
- Artillery Sidewinder X1 3D Printer
- PETG 3D 1, 75 mm Filament
- Motor mount files
- Odrive case
- Kria mount files
- Velodyne mount files
Devices
- Startech 7-Port ST7300USBME
- Kria kv-260
- Logitech C920 HD Pro Webcam,
- NGS XPRESSCAM300
- Odrive V3.6
- 11.6inch Capacitive Touch Screen LCD with Case
- RBE-102024-003 24V 6.5-inch wheel hub motor
- Velodyne VLP16
- Velodyne Lidar Junction Box
- WiFi USB Adapter
- Bluetooth USB Adapter
- Sony PS3 Controller GASIA
Power
- RIDEN RD6018W Digital Power Supply.
- 12 Volt 14 Amp HG12-14V Carbon Gel batteries
- Lead-acid battery charger 24 Volts 2.8 Amps SLA, AGM
- 1.3/3.5mm DC Power Plug
- 486-3574-ND PWR PLUG 2.5X5.5MM
- CTRICALVER M116
- HSKG-3
- 24T12-10A, 24v to 12v Power Converter 10V 120W
- 4/5/6 Position 600V 25A
Wires
- 18awg Cable
- 16awg Cable
Fasteners
- M6 DIN912 Hexagon Socket Head Screws 10, 12, 14, 16 mm
- M2.3 10mm phillips round washer head screw
- M2.6 8mm phillips round washer head screw
- M2.6 10mm phillips round washer head screw
- M3 10mm phillips round washer head self tapping screw
- M3 M4 screws
- 300 Pieces Hex Cap Screws
- 120 x M6 Stainless Steel Hex Head Screws
Signaling
- 0, 5m Micro USB Cable
- HDMI 50 cm Cable
- USB isolator module
- JUMPER SPAL-001T-P0.5 X2 12"
- CONN HOUSING PAL 5POS 2MM
- CONN HOUSING PAL 6POS 2MM WHITE
Tools
- Solder and iron
- Multimeter
- Wire strippers and cutters
- Crimp tools
In the next section, some component wiring diagrams are shown.
Power-System Wiring
Karp uses 2 x 12V/14A batteries to power the different components of the system. This is so since the motors need a voltage of around 24V for their operation. When buying the batteries, they come with cables to be able to connect them in series and one of the cables contains a 15A fuse (which is not drawn in the image) so that we do not damage the circuit. This 24 voltage goes to a switch and this in turn to a splice connector which powers a DC-DC 24V to 12V converter and to the Odrive board. We need the 12V converter since all the system components connected in Karp need to be powered using 12V. For connecting Kria, Velodyne, and Touch screen you will need the help of a soldering iron to create cables using the 1.3/3.5mm DC Power Plug and 2.5/5.5mm DC Power Plug.
CommunicationsWiring
Kria board communicates with system peripherals through HDMI, Ethernet, and USB. HDMI is used for displaying images on the touch screen, the Ethernet is used for communicating with the Velodyne Lidar, and USB is used for communicating with Odrive board, obtaining video feeds from the Webcam, and two USB adapters, Wireless and Bluetooth for accessing to the board and manual control using a PlayStation 3 controller.
4. Assembly InstructionsAssemble the robot is not difficult you can take the 3030 aluminum profiles, 3-Way End Corner Bracket Connector, L Brackets Connector, and start mounting the bottom part of the robot as you can see in the image.
The RBE-102024-003 24V 6.5-inch wheel hub motors are mounted in Motor mount files and you can fix them to aluminum profiles using Nuts 30s-m6, and M6 Hexagon Socket Head Screws. You can add the Alex castor wheels in the same way to the profiles.
For the bottom side, we will use an MDF board with the following form.
This will allow us to pass the cables of both the motors and the battery through the holes in the corners.
You can place the batteries at the bottom like this (is not very comfortable for charging the batteries, it will change)
Therefore, once the lower part is assembled we can start placing different components.
We are going to place Odrive board in the front of the robot so we can facilitate wiring. And all the power components will go at the bottom of the robot so we can easily connect to the battery.
Since we are using MDF we will use some screws to screw the components to the base.
You should see something like this when all the components are placed in the base,
At the top methacrylate plate, we have placed the NGSS camera and the switch. To know more about the components in the image you can follow the Power-System Wiring section diagram.
If you don't want to use the LCD screen you can leave the robot like this, once the methacrylate plate and the top part are added.
If you prefer to place the LCD monitor the monitor has 4 screws so you can attach it as follows
Finally, the robot looks like this,
In order not to make this project very long, I have decided to create different subprojects about them and write there the different steps followed to get the robot running.
These steps have gone since creating the image using Petalinux 2021.2, working with ROS 2, creating deep-learning applications using Vitis-AI 2.0, creating a Host Acces Point for the robot, controlling the robot with a PlayStation controller, controlling wheel hub motors, and sensing the environment using a Velodyne Lidar.
5.1 Petalinux base project
PetaLinux tools ease the development of Linux-based products; all the way from system boot to execution with the following tools. I am not going to expand on this section since there are already similar tutorials on the net but I will put the most interesting commands for creating the project.
For creating a Petalinux 2021.2 project I took as a starting point the starterkit-2021.1 bsp package. I followed the steps on the README file contained there and after checking all the different folders I created my own bsp for 2021.2 version. Finally I used the next command to create the bsp,
petalinux-package --bsp -p xilinx-k26-starterkit-2021.2 --output xilinx-k26-starterkit-v2021.2-custom.bsp
Once I had the bsp for Petalinux 2021.2 I started creating my own image with,
$ petalinux-create -t project -s xilinx-k26-starterkit-v2021.2-custom.bsp -n karp
$ cd karp
$ petalinux-config --silentconfig
This creates the Petalinux projects and configures it, and with the next commands we build the project and create an SD Card and we check that the board boots.
$ petalinux-build
$ petalinux-package --wic --bootfiles "ramdisk.cpio.gz.u-boot boot.scr Image system.dtb"
$ gzip images/linux/petalinux-sdimage.wic
If the board boots now we are ready to start adding different packages to this image.
5.2 Adding ROS 2
The Robot Operating System (ROS) is a set of software libraries and tools for building robot applications. Since ROS was started in 2007, a lot has changed in the robotics and ROS community. The goal of the ROS 2 project is to adapt to these changes, leveraging what is great about ROS 1 and improving what isn’t.
The installation of ROS 2 in Petalinux and how to launch a simple publisher/subscriber example can be found in the next link:
Here is a video of the publish/subscriber example
As a separate project, its operation was also verified on an Ultra96v2 board.
5.3 Adding Vitis-AI 2.0
The Vitis™ AI development environment Is Xilinx’s development platform for AI inference on Xilinx hardware platforms.
The Vitis AI Library is a set of high-level libraries and APIs built for efficient AI inference with the Deep-Learning Processor Unit (DPU).
Karp uses Vitis-AI 2.0 and Yolov4 deep neural network for real-time object detection and also uses MultiTask V3 which includes object detection, segmentation, lane detection, drivable area segmentation, and depth estimation, which are important components of the autonomous driving perception module.
In the next link, we explain how to install Vitis-AI and Xilinx Deep Learning Processor Unit (DPU) in our Petalinux image and we run Yolov4 real-time object detection network and MultiTask v3.
Some videos of Vitis-AI 2.0 working in Karp,
5.4 Add Wifi and Host Access Point Daemon (HostAPD)
Karp uses an Edimax AC6000 USB Realtek 8821au device to create a Wireless network. In the next tutorial, you can found how to compile the necessary drivers, connect the Kria board to a WiFi network, and finally create an access point using hostapd in Petalinux.
5.5 Bluetooth, Sixad, and jstest
Kria Autonomous Robotic Platform (Karp) uses a BelkinUSBBluetoothAdapter and PlayStation 3 Joystick if you want to move the robot manually. In the next tutorial, you can find which things are necessary to change inside the Petalinux project to make the Joystick work and pair it with the Bluetooth Adapter to send the corresponding commands to the Kria board using ROS 2.
A video of controlling motors using the PlayStation 3 Joystick,
5.6 Motor control using Odrive.
Karp uses Odrive board for controlling the RBE-102024-003 24V 6.5-inch wheel hub motor with an encoder. In this tutorial, you can find how to install Odrive on our Petalinux image, how to calibrate the motor and encoders, and how to move the motor using ROS 2.
5.7 Velodyne Lidar
Karp uses a Velodyne VLP16 Lidar for sensing the environment and checking the surroundings. In this tutorial, you can find how to connect this Lidar to the Kria KV260 board and how we can see the sensor information using ROS 2.
6. Running KarpAll the recipes for creating the Petalinux image for Karp can be found in meta-karp.
The Kria Autonomous Robotic Platform (Karp) ROS 2 packages are located in Karp repository.
And for launching ROS 2 in your workstation, the easiest way is to use karp_ros2_ws repository. This repository is based on Allison Thackston vscode_ros2_workspace, which is a template to set up ROS 2 with VSCode as your IDE. You can follow the guide how I develop with vscode and ros2 for learning more about working with VSCode, docker, and ROS 2.
For moving the robot, it is very important to have battery both in the controller and in the car.
After booting the board, clone
Videos and how to run Karp repository on /home/petalinux path and launch odrive_config.py python script to calibrate motors.
cd /home/petalinux/dev_ws/src
python3 karp/karp_odrive/scripts/odrive_config.py
Now if we want to control the robot manually, we need toactivate the joystick. For this, we start sixad and give access to js0 device.
sudo sixad --start &
sudo chmod +rw /dev/input/js0
If you cannot connect the control be sure that your controller can be paired with Kria Bluetooth master. Connect the USB cable and do:
$ sudo hciconfig hci0 up
$ sudo sixpair
Current Bluetooth master: 43:45:c0:00:1f:ac
Setting master bd_addr to 00:19:0e:04:18:8f
Now we will launch our ROS 2 launch file for working with the joystick,
source /usr/bin/ros_setup.bash
cd dev_ws
source install/setup.bash
ros2 launch karp_bringup karp.launch.py
Instead, if we want to activate Velodyne, we need to launch,
ros2 launch karp_bringup karp.launch.py launch_velodyne:=true
And Voila! Now you should be able to move the robot and start working.
If you want to launch Vitis-AI 2.0 examples while moving the robot, you can activate the DPU accelerator,
sudo xmutil unloadapp kv260-dp
sudo xmutil loadapp benchmark-b4096
And launch both multitask_v3_quad_windows and MultiYolov4 examples with camera view using 0 and 2 values,
multitask_v3_quad_windows
cd Vitis-AI-Library/apps/multitask_v3_quad_windows
sudo ./multitaskv3_quad_windows_drm 0 -t 4 > /dev/null 2>&1
MultiYolov4
cd Vitis-AI-Library/apps
cd karp
sudo ./karp_yolov4_drm 0 2 -t 3 -t 3 > /dev/null 2>&1
7. Karp ExtensionsKarp is easily customizable depending on the application that we want to give to this robotic platform.
In the image above we can see how the size of Karp has increased with the help of other aluminum profiles. Thanks to the shelves placed on the aluminum profiles Karp is now capable of transporting us drinks wherever we are to celebrate the end of our writing.
Modifying the robot and being able to see it in rviz is not complicated, you can modify the URDF (United Robotics Description Format) files located in karp_description/urdf/karp.urdf.xacro and while you are making the changes you can view them with the following command.
ros2 launch karp_description view_karp_robot.launch.py
This will open rviz and we were able to see our robot model, joints and more like in the image.
Given the temporary limitations of the Adaptive Computing Challenge that ends on March 31, I have documented in this project and in the embedded subprojects mentioned the work carried out to date, leaving for later projects related to Digital Twins using the Ignition Gazebo or Isaac Sim simulators, the ROS 2 Navigation package, Vitis-AI 2.0 exploration and application examples using Lidar data, or more hardware-accelerated applications using ROS that I want to tackle.
Finally, if you liked the project and the videos and you want to have more please give me a like on Hackster or subscribe to my Youtube. Become my Patreon!
Thank you for reading!
Comments