About the robot

The robot is based on the ESP32-WROOM module, which offers a dual-core microcontroller with WiFi and Bluetooth functionalities. The robot comes with pre-installed firmware and is ROS-compatible out of the box. However, if you want to modify the firmware and implement additional functionalities, additional software is needed.

Robot firmware is available under rosbot_core folder in the ROSin Ljubljana repository.

Installation

The firmware is developed using PlatformIO collaborative development platform from within Visual Studio Code. To install, first install Visual Studio Code and then search for PlatformIO IDE under Extensions.

For programming on Linux, user needs to be added to the dialout group (Log out and Log in again after change).

sudo usermod -a -G dialout <username>

Initial setup

Starting the robot

The robot kit includes a Li-Ion 18650 battery. Make sure that the battery is inserted in the correct position (see + and - markings on the PCB), otherwise the electronics might get damaged. The robot is started simply by turning the main switch ON.

The robot can be powered either from the battery or from a USB cable. When both are connected, the battery automatically begins charging.

Configuring the settings on the robot

Open rosbot_core folder in Visual Studio Code. Use PlatformIO Monitor (or any other serial monitor) to connect to the robot. Reset the robot using the RESET button. The following message will be printed. (You might have to press the RESET button again.)

========================================

    Welcome to ROSin Ljubljana.

========================================
Setting up EEPROM
Reading default parameters
........................................

Press NUMBER to enter submenu.
1 - WIFI
2 - PID
3 - Sensors
4 - Print ALL settings

Press USER button to exit setup.

The menu is easily navigated using numbers to select the submenus.

WiFi settings

Using the robot's menus, connect the robot to WiFi and define the PC's network address.

  • Under WIFI (1) set SSID (1) to the WiFi network, to which the PC is connected, and PASS (2) to the network password.
  • Set ROS Master (3) to the IP address of the PC. Write it as a string, e.g. 192.168.1.100. Note: Check the IP address of the PC using ifconfig.
  • Check if the settings are correct by selecting Print ALL settings (4).

To finish configuring the settings, press the USER button on the robot. The robot will start sending data to the PC.

If the ROS system is not already running on your computer you can expect a socket error message printed in the terminal (errno: 104, "Connection reset by peer").

Starting the ROS system on the computer

For the robot to be able to communicate with ROS, the ROS system needs to be running with the neccessary nodes. Also, the ROS network settings need to be configured.

Configuring the ROS network on the computer

The ROS_IP environment variable needs to be set to the value of the IP address of the computer. Note: Check the IP address of the PC using ifconfig.

export ROS_IP=<computer_ip_address>

Starting the ROS system

Navigate to the location of the workspace (in our case to the rosbot_ros directory). Then run:

source devel/setup.bash
roslaunch rosbot mapping.launch

An RViZ interface should open. The PC is now waiting to receive the data from the robot.

Warning: the following packages need to be installed on the PC:

  • ros-melodic-rosserial-server
  • ros-melodic-mouse-teleop
  • ros-melodic-teleop-twist-keyboard
  • ros-melodic-slam-gmapping
  • ros-melodic-imu-tools
  • ros-melodic-robot-localization

To install all the above packages, run:

sudo apt-get update
sudo apt-get install ros-melodic-rosserial-server ros-melodic-mouse-teleop ros-melodic-teleop-twist-keyboard ros-melodic-slam-gmapping ros-melodic-imu-tools ros-melodic-robot-localization

Interacting with the robot

Open the terminal and send a message to the robot using the rostopic pub command:

rostopic pub /lidar std_msgs/Bool "data: true"

The map of the robot's environment should start appearing in RViZ!

To stop the robot lidar send false to the /lidar topic:

rostopic pub /lidar std_msgs/Bool "data: false"

Mobile robot simulation

We will also use a mobile robot simulation in the tutorials. However, in order to run the simulation, you must have two more ROS packages installed: move_base and map_server. To install these two packages, run the following commands:

sudo apt-get install ros-melodic-move-base

sudo apt-get install ros-melodic-map-server

To test if mobile robot simulation works, run:

cd .../rosbot_ros

source devel/setup.bash

roslaunch rosbot simulation.launch

If everything looks ok, just that a laser scan is not visualized in Gazebo and RViz GUIs, you may have to correct two things in the robot.xacro file, which you will find inside .../rosinljubljana/rosbot_ros/src/rosbot/urdf folder:

  • search for "gpu_ray", and change it to "ray",
  • search for "libgazebo_ros_gpu_laser.so", and change it to "libgazebo_ros_laser.so".