Skip to content

Latest commit

 

History

History
525 lines (381 loc) · 29.5 KB

File metadata and controls

525 lines (381 loc) · 29.5 KB

andino_hardware

This package aims to provide the necessary information to the correct assembly of the robot.

Important

The hardware has been updated. If you are looking for the old design please go to f7af556d00a099cf18a9d1e17eb7e725fa97e1da

Bill of Materials

Part_number Image Part_name Links Comments
1 Raspberry Pi 4 B (4 Gb) PiShop, TiendaTec, Amazon If you want better performance you could buy the 8GB model
2 Base_chassis 3D printed
3 lidar_chassis 3D printed
4 Battery_chassis 3D printed
5 Arduino_lock_base 3D printed
6 Camera_case 3D printed
7 2 x Motor with Encoder Sparkfun Motor name: Hobby Motor with Encoder - Metal Gear (DG01D-E)
8 Wheels Amazon Wheels are generic wheels for TT motors.
9 Arduino Nano Amazon Arduino pins can be soldered in any position, but it is recommended to solder them as shown in the picture.
10 IMU - BNO055 Amazon -
11 L298N Dual H Bridge Amazon -
12 RPLidar A1M8 RobotShop, Amazon If no microUSB-USB cable is included, you will need to purchase one
13 Raspi Camera Module V2, 8 MP Robotshop, Amazon, Longer cable A link for a longer cable (30 cm) is included, just in case the one included with the camera is too short.
14 Battery Case Amazon Link is for a 6 pack cases but only one is needed.
15 Batteries Amazon Any 18650 batteries should work
16 Batteries charger Amazon You can buy any 18650 battery charger e.g one for more than 2 batteries.
17 DC - DC converter Amazon You can use any stepdown DC-DC regulator that supports and input of 12V and give 5V output at at least 3A
18 Kill-Switch Amazon Mounting hole is 13 x 20 mm
19 Caster wheel Amazon -
20 SD Card 64 GB SD Card Apokin, Amazon The SD Card is used to host the OS for the Raspberry Pi
21 screws kit Amazon You don't need all the screws but here you can get all the screws that you need in the screw-table
22 zip ties Amazon Link is a good option, but your only going to use 4 to 6

Screw table

Size length quantity needed
3m 6mm 0
3m 8mm 2
3m 10mm 4
3m 12mm 6
3m 16mm 5
3m 20mm 0
3m 25mm 2
3m 30mm 4
3m Nuts 19

Tooling

Number Tool Links Comments
1 Set of screwdrivers Amazon

Assembly Process

1. Rear wheel

Place the base chassis face down, install the wheel in the base chassis.

Place the base chassis face up.

2. Motors and IMU

Install motors using 4 X 30mm screws and the IMU using a zip tide as shown in the image.

3. Camera

Pass the camera flex through the hole below the IMU base as shown in the image.

Place the camera inside the camera case as shown in the image.

Place the camera case in its position as shown in the image, be careful when you spread the base, to avoid braking it.

4. Raspberry

Rotate the base 180 degrees and place the raspberry as shown in the image. And place the wheels by inserting them into the motors.

5. Motor Driver

Add power and 5V cables to the motor driver. at least 15cm for power cables.

Finish all the driver connections according to the connection diagram

6. Arduino

Place the arduino using the arduino lock base.

Make the remaining connection of the connection diagram and organize the cables as you prefer.

7. Lidar Base

Place the lidar in the lidar base as shown in the image.

Fix the lidar driver to the lidar base using zip tides as shown in the image.

Place the lidar base above the base cassis and use screw it in place.

8. Battery chassis.

Place the 5V step down driver and the killer switch in the battery chassis as shown in the image.

Exterior should looks like this

Place the battery case inside the battery chassis as shown in the image.

9. Final Assembly

Make all the power connections in the power connections schema and place the battery chassis in the base chassis as shown in the image.

10. Final Andino closed

Connection Diagram

Motor-Arduino

Some frequent errors:

  • If one of the motors rotates in the opposite direction (think about the orientation of the motors in the chassis) probably the output(+ and -) of the L298N's output should be toggled.
  • When moving forward the encoder values should increase while moving backwards they should decrease. If it is happening the other way around probably the A and B encoder signals should be toggled.

Raspberry-Power

Note

Ground cable to the switch is only necessary if it has a led indicator.

Note

For the camera ensure the ribbon cable is properly connected with the blue or silver side facing the USB ports.

Microcontroller Configuration

For uploading the microcontroller firmware please refer to andino_firmware package.

Single Board Computer (SBC)

The SBC used in this project is a Raspberry Pi 4b so the guidelines here will refer particularly to this family of on-board computers, however extending its use to other families is possible as well.

This section details the required configuration that is needed in the SBC. You can either follow these steps or rely on community contribution (Recommended) for installing this via ansible playbooks: See https://github.com/garyservin/andino_ansible_config

Operative System

The recommended operative system depends on which ROS 2 distro you want to use:

  • Humble: Ubuntu Mate 22.04 ARM64 - Download
  • Jazzy: Ubuntu Server/Desktop 24.04 - Download

Important

It should work with either Desktop or Server versions. Desktop versions naturally are slower. Refer to https://ubuntu.com/download/raspberry-pi for general information on Ubuntu installation on Raspberry Pi.

For installing this OS in the Raspberry:

  1. Download the image for your target ROS distro (see above).

  2. Install OS to a microSD card using Raspberry Pi Imager.

    • No extra configuration should be necessary.
  3. Boot your raspberry using the microSD and a HDMI connection. Some initial configuration is necessary. Follow the wizard for a proper set up. It is recommended to use simple User and Password combinations for the user. For example:

    • user: pi
    • password: admin
  4. Once is done, run sudo apt update && sudo apt upgrade in a terminal for updating the system. Then reboot.

Installing dependencies

Some packages are necessary to be installed towards a correct set up of the robot's on-board computer.

ssh-server

In general, you will want to access to the Raspberry remotely via ssh connection while being connected in the same network. So we need to install ssh-server;

sudo apt-get install openssh-server

Enable it if it is not enabled yet:

sudo systemctl enable ssh --now

After this you will be able to access this device from a remote computer by doing:

ssh <user>@<ip>

For example if the user is pi and the ip is 192.168.0.102

ssh pi@192.168.0.102

Common utilities

Install some common utilities that will be required later on.

sudo apt update
sudo apt install git net-tools software-properties-common build-essential -y
sudo apt install python3-rosdep2 python3-catkin-pkg python3-catkin-pkg-modules python3-rospkg-modules python3-rospkg  -y

Install ROS and Tools

  • Colcon Follow suit the instructions for installing next dependencies from binaries:
  • ROS 2 Humble(If Ubuntu 22.04)
  • ROS 2 Jazzy(If Ubuntu 24.04)

    [!IMPORTANT] It is worth checking out official instructions on installing ROS on Raspberry PI platforms, in particular for Jazzy onwards. See here: Relying on noble-backports in Ubuntu Noble (24.04) is necessary.

To automatically source ROS installation, it is recommended to add source /opt/ros/humble/setup.bash line to the ~/.bashrc file.

Arduino

Arduino drivers are necessary for the SBC (Raspberry) <--> Microcontroller(Arduino) serial communication.

sudo apt install arduino

Configure it properly:

  1. Add user to dialout and plugdev groups:
    sudo usermod -a -G dialout $USER
    
    sudo usermod -a -G plugdev $USER
    
    Note you will need a reboot after this to be effective.

Important

In Ubuntu 22.04 seems to be an issue with some chip drivers and the brltty daemon. To avoid ?> this conflict we remove brltty as suggested. See [this stackoverflow post](https://stackoverflow.com/>? > questions/70123431/why-would-ch341-uart-is-disconnected-from-ttyusb) for further information.

  • Remove brltty from the system sudo apt remove brltty

Raspberry Camera Module V2

After connecting the camera module to the Raspberry's camera port.

sudo apt install libraspberrypi-bin v4l-utils
sudo usermod -aG video $USER

Check camera status:

vcgencmd get_camera

If the output of the previous command is `supported=1 detected=1', everything is fine. If not, your camera won't work correctly, you need to perform some configuration first.

Modify the config.txt file for the boot:

 sudo nano /boot/firmware/config.txt

And add these lines under [all]:

# Autoload overlays for any recognized cameras or displays that are attached
# to the CSI/DSI ports. Please note this is for libcamera support, *not* for
# the legacy camera stack
start_x=1
gpu_mem=128

Save and close the file. Then we need to enable the camera support for the raspberry:

sudo apt install raspi-config
sudo raspi-config

Go to Interface Options, select camera and enable it.

Finally, you just need to reboot and the camera should be working fine.

RPLidar installation

The installation of the A1M8 RPLidar sensor is quite straight forward and a ros integration package will be installed later on via rosdep.

For now, after connecting it to the usb port:

  1. Verify USB connection: Green light in the usb conversor(A1M8 side board) should be turned on.
  2. Check the authority of RPLidar's serial-port:
    • ls -l /dev |grep ttyUSB
    • Add extra bits by doing sudo chmod 666 /dev/ttyUSB<number_of_device>

USB Port name configuration

Fixed USB port names

As having multiple USB devices connected to the USB ports of the Raspberry Pi, the automatically assigned USB port numbers could unexpectedly change after a reboot. To avoid assigning your device to a tty_USBX number that isn't the correct one we should assign fixed USB port name for each connected device.

The idea is to be able to generate a link between the real ttyUSBX port and an invented one. For this we will need to create rules, that every time the Raspberry Pi boots are executed, and therefore we always point to the correct port name.

In order to create fixed names for the USB devices follow the instructions:

  1. Check the devices you have connected:

    sudo dmesg | grep ttyUSB
    
    [  10.016170] usb 1-1.2: ch341-uart converter now attached to ttyUSB0
    [ 309.186487] usb 1-1.1: cp210x converter now attached to ttyUSB1
    

    In the setup where this was tested we have: -> Arduino Microcontroller -> usb 1-1.2: ch341-uart converter now attached to ttyUSB0 -> A1M8 Lidar Scanner -> usb 1-1.1: cp210x converter now attached to ttyUSB1

    Note: If you don't know how to identify each one you can simply connect them one by one and check this output.

  2. Look for attributes for each device that we will use to anchor a particular device with a name. We will use the idProduct and idVendor of each device.

    • Arduino Microcontroller:
      udevadm info --name=/dev/ttyUSB0 --attribute-walk
      
      You should look for the idProduct and idVendor under the category that matches the usb number(1-1.X): In this case the ttyUSB0 was referenced to the usb 1-1.2, so go to that section and find the ids:
        ATTRS{idProduct}=="7523"
        ATTRS{idVendor}=="1a86"
      
    • Lidar Scanner
      udevadm info --name=/dev/ttyUSB1 --attribute-walk
      
      In this case the ttyUSB0 was referenced to the usb 1-1.1, so go to that section and find the ids:
        ATTRS{idProduct}=="ea60"
        ATTRS{idVendor}=="10c4"
      
  3. Create the rules:

    Open the file:

    sudo nano /etc/udev/rules.d/10-usb-serial.rules
    

    Add the following:

    SUBSYSTEM=="tty", ATTRS{idProduct}=="7523", ATTRS{idVendor}=="1a86", SYMLINK+="ttyUSB_ARDUINO"
    SUBSYSTEM=="tty", ATTRS{idProduct}=="ea60", ATTRS{idVendor}=="10c4", SYMLINK+="ttyUSB_LIDAR"
    

    [!IMPORTANT] You should be using your own information you obtained from previous commands, this is just an example. Note that in the symlink field a fixed name is indicated.

  4. Re-trigger the device manager:

    sudo udevadm trigger
    
  5. Verify

    ls -l /dev/ttyUSB*
    
    crw-rw---- 1 root dialout 188, 0 Sep  2 15:09 /dev/ttyUSB0
    crw-rw---- 1 root dialout 188, 1 Sep  2 15:09 /dev/ttyUSB1
    lrwxrwxrwx 1 root root         7 Sep  2 15:09 /dev/ttyUSB_ARDUINO -> ttyUSB0
    lrwxrwxrwx 1 root root         7 Sep  2 15:09 /dev/ttyUSB_LIDAR -> ttyUSB1
    

Done! You can always use your devices by the fixed names without using the port number. Here, ttyUSB_ARDUINO and ttyUSB_LIDAR are fixed names for the Arduino Microcontroller and the Lidar Scanner respectively.

For more information you can take a look at this external tutorial: Here

Create robot workspace

Let's create our workspace and build from source this repository.

cd ~
mkdir robot_ws/src -p

Clone this repository in the src folder

cd robot_ws/src
git clone <repository_address>

Install dependencies via rosdep:

cd ~/robot_ws

When it is the first time you run rosdep:

rosdep update

Make sure to export the ROS_DISTRO environment variable (use humble or jazzy depending on your installation):

export ROS_DISTRO=humble  # or jazzy

And then proceed to install the workspace dependencies:

rosdep install --from-paths src -i -y -r

Note that option -r has been added. For ARM based processors, there are missing packages, e.g. those related to simulation. We would not try to run the simulation in the compute platform of andino, however for convenience it is added here.

Let's source the ROS installation:

source /opt/ros/$ROS_DISTRO/setup.bash

Let's build the packages:

colcon build

After building is completed:

source install/setup.bash

After this, you are good to go and use the robot! Refer to usage section.

Extra Recommendations & Tools

Network

Via terminal the wifi connection can be switched by doing:

List available wifi networks:

sudo nmcli dev wifi list

Connect to the desired one:

sudo nmcli --ask dev wifi connect <SSID>

Copy files remotely

Using scp is a useful tool when copying files remotely over ssh.

For copying a folder from host to remote unit:

scp -r <path/to/folder> <remote_user>@<remote_ip>:<remote_path_to_folder>

ROS Domain ID

The domain ID is used by DDS to compute the UDP ports that will be used for discovery and communication.

When using a "public" network using the domain id is a good technique to avoid extra noise with other ROS 2 system in the same network.

See ROS_DOMAIN_ID

TLDR? Export an environment variable with the same ID in all ROS 2 clients in the network for a correct discovery.

export ROS_DOMAIN_ID=<a_number_between_0_and_101>

Using joystick for teleoperation

andino_bringup package provides a launch file for launching the corresponding ROS 2 nodes for teleoperating the robot using a joystick.

It is worth mentioning that a set up might be needed depending on the gamepad you are using. Here some general guidelines:

  • In case you are using a Xbox One Controller and you want use it wireless (via USB Wirless Dongle) installing Xone is recommended.
  • Verify that your joystick is actually working on Ubuntu:
    • Some tools that might be useful:
      • sudo apt install joystick jstest-gtk evtest
    • Run evtest to check if your pad is connected:
      $ evtest
        No device specified, trying to scan all of /dev/input/event*
        Not running as root, no devices may be available.
        Available devices:
          /dev/input/event22:	Microsoft X-Box One pad
      
      
    • Alternatively, you can use jstest-gtk to check the controller, you will find a pretty GUI to play with.