Skip to content

Navigation

Required setup: smabo-app + smabo-esp32 + smabo-brain-ros

This page is the guide for the 'Navigation' node on the roadmap below.

This guide assumes you have completed the Encoder Mobile Robot and brain-ros guides.

This page explains how to implement the "Navigation" feature.


Specifically, you will:

  • Run SLAM
  • Run navigation

In addition to the parts from Encoder Mobile Robot, you need the following.

Part Example (Japanese shop) Notes
LiDAR (LDROBOT LD19) - -
Breadboard-to-JST ZHR cable (4-pin, 1.5 mm pitch, single connector) link Connects the LD19 to the ESP32 (not needed if it comes with your LD19)

Print the newly added parts on your 3D printer.

Because slicer software varies by printer model, only key points are noted here rather than step-by-step slicer instructions.


Print the following parts oriented as shown in the images.

  • smabo-hardware/stl/lidar/ld19/ld19_base.stl 3D-printed LD19 base ld19_base

  • smabo-hardware/stl/lidar/ld19/ld19_stopper1.stl 3D-printed LD19 stopper ld19_stopper1

  • smabo-hardware/stl/lidar/ld19/ld19_stopper2.stl 3D-printed LD19 stopper ld19_stopper2

Assemble the required parts as shown in the video below.

Note: the video also includes parts printed in previous steps.


Wire according to the tables below.

In the tables below, "Point A" and "Point B" are directly connected in the circuit.

Point A Point B Notes
Battery box (+) Breadboard + rail (right side) From here on, the right side is the 6 V rail
Battery box (-) Breadboard - rail -
Point A Point B Notes
ESP32 3.3V Breadboard + rail (left side) From here on, the left side is the 3.3 V rail
ESP32 GND Breadboard - rail -
Point A Point B Notes
TB6612FNG PWMA ESP32 pin set in config.json dc/pins/pwma Default pins:
- config.esp32-classic.json: GPIO 32
- config.esp32s3-devkitc1.json: GPIO 4
TB6612FNG AIN2 ESP32 pin set in config.json dc/pins/ain2 Default pins:
- config.esp32-classic.json: GPIO 33
- config.esp32s3-devkitc1.json: GPIO 5
TB6612FNG AIN1 ESP32 pin set in config.json dc/pins/ain1 Default pins:
- config.esp32-classic.json: GPIO 25
- config.esp32s3-devkitc1.json: GPIO 6
TB6612FNG STBY ESP32 pin set in config.json dc/pins/stby Default pins:
- config.esp32-classic.json: GPIO 26
- config.esp32s3-devkitc1.json: GPIO 7
TB6612FNG BIN1 ESP32 pin set in config.json dc/pins/bin1 Default pins:
- config.esp32-classic.json: GPIO 27
- config.esp32s3-devkitc1.json: GPIO 15
TB6612FNG BIN2 ESP32 pin set in config.json dc/pins/bin2 Default pins:
- config.esp32-classic.json: GPIO 14
- config.esp32s3-devkitc1.json: GPIO 16
TB6612FNG PWMB ESP32 pin set in config.json dc/pins/pwmb Default pins:
- config.esp32-classic.json: GPIO 12
- config.esp32s3-devkitc1.json: GPIO 17
TB6612FNG VM Breadboard + rail (right side) Motor power (6 V)
TB6612FNG VCC Breadboard + rail (left side) Logic power (3.3 V)
TB6612FNG GND Breadboard - rail The TB6612FNG has three GND pins; connect all of them to the breadboard's - rail
Point A Point B Notes
DG01D-E (left wheel) G Breadboard - rail -
DG01D-E (left wheel) H1 ESP32 pin set in config.json encoder/left/b Default pins:
- config.esp32-classic.json: GPIO 21
- config.esp32s3-devkitc1.json: GPIO 42
DG01D-E (left wheel) H2 ESP32 pin set in config.json encoder/left/a Default pins:
- config.esp32-classic.json: GPIO 19
- config.esp32s3-devkitc1.json: GPIO 41
DG01D-E (left wheel) V Breadboard + rail (left side) Encoder power (3.3 V); H1 and H2 also use this voltage
DG01D-E (left wheel) M+ TB6612FNG A02 -
DG01D-E (left wheel) M- TB6612FNG A01 -
DG01D-E (right wheel) G Breadboard - rail -
DG01D-E (right wheel) H1 ESP32 pin set in config.json encoder/right/a Default pins:
- config.esp32-classic.json: GPIO 22
- config.esp32s3-devkitc1.json: GPIO 2
DG01D-E (right wheel) H2 ESP32 pin set in config.json encoder/right/b Default pins:
- config.esp32-classic.json: GPIO 23
- config.esp32s3-devkitc1.json: GPIO 1
DG01D-E (right wheel) V Breadboard + rail (left side) Encoder power (3.3 V); H1 and H2 also use this voltage
DG01D-E (right wheel) M+ TB6612FNG B02 -
DG01D-E (right wheel) M- TB6612FNG B01 -
Point A Point B Notes
LD19 Tx ESP32 pin set in config.json lidar/rx Default pins:
- config.esp32-classic.json: GPIO 4
- config.esp32s3-devkitc1.json: GPIO 18
LD19 PWM Breadboard - rail Rotation speed control input. Speed is not controlled externally, so tie it to GND to spin at the built-in speed control (10 Hz)
LD19 P5V ESP32 5V LiDAR power (5 V). It does not run on 3.3 V, so connect it directly to the ESP32's 5V pin, not to the left side of the + rail
LD19 GND Breadboard - rail -

The wiring diagram for the ESP32-DevKitC (with the defaults in config.esp32-classic.json) is shown below.

Wiring diagram for the LD19 LiDAR, the DG01D-E encoder motors and the ESP32

The completed robot looks like this.

The finished navigation robot with the LD19 LiDAR

Check that everything works with the steps below.

Follow the startup procedure here.


Then, in the 'Config' tab of smabo-web, enable:

  • 'dc_drive' and 'encoder' inside it
  • 'lidar'

This section explains how to run SLAM.

In the 'Navigation/SLAM' tab of smabo-web, click 'Start SLAM'.

The Navigation/SLAM tab of smabo-web, with the 'Start SLAM' button boxed in red

In the 'Drive' tab, drive smabo with the controller to build the map.

  • If you place the 'Drive' tab and the 'Navigation' tab side by side, you can check how the map is coming along while you drive smabo.

The 'Drive' tab on the left and the 'Navigation' tab on the right, with the map being built shown in View

When the map is finished, enter any map name and click 'Save'.

The Navigation/SLAM tab of smabo-web, with the map name field and the 'Save' button boxed in red


In the 'Navigation/Navigation' tab of smabo-web, select the map you just built and click 'Start Navigation'.

The Navigation/Navigation tab of smabo-web, with the map name selector and the 'Start Navigation' button boxed in red

Click the 'Nav2 Goal' button in 'View'.

The Navigation tab of smabo-web, with the 'Nav2 Goal' button in View boxed in red

When you specify any position on the map, smabo starts driving toward it.

  • Arrow position: the goal position
  • Arrow direction: the direction smabo faces after reaching the goal

This page is one of the end points of the roadmap.