Note
MoboBot uses RaspberryPi 4B microcomputer running Ubuntu 22.04 and ros-humble-base. You can follow this tutorial to install ros-humble-base on RaspberryPi 4B with colcon and rosdep
- install the
libserial-dev
package on the Raspberry Pi 4b machinesudo apt-get update sudo apt install libserial-dev
- install cyclone DDS (if you have not) on the Raspberry Pi 4b machine
sudo apt install ros-humble-rmw-cyclonedds-cpp export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp echo "export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp" >> ~/.bashrc
- install opencv on the Raspberry Pi 4b machine
sudo apt install libopencv-dev python3-opencv pip3 install opencv-python
-
create your <ros_ws> in the home dir. (replace <ros_ws> with your workspace name)
mkdir -p ~/<ros_ws>/src cd ~/<ros_ws> colcon build source ~/<ros_ws>/install/setup.bash
-
cd into the src folder of your <ros_ws> and download the mobo_bot packages
cd ~/<ros_ws>/src git clone -b humble https://github.com/robocre8/mobo_bot.git
-
cd into the mobo_bot/mobo_bot_sim folder and add a
COLCON_IGNORE
file to the mobo_bot_sim package to prevent runnig simulation on the Raspberry Pi.cd ~/<ros_ws>/src/mobo_bot/mobo_bot_sim touch COLCON_IGNORE
-
cd into the mobo_bot/mobo_bot_rviz folder and add a
COLCON_IGNORE
file to the mobo_bot_rviz package to prevent running rviz visualization on the Raspberry Pi.cd ~/<ros_ws>/src/mobo_bot/mobo_bot_rviz touch COLCON_IGNORE
-
cd into the mobo_bot/mobo_bot_teleop folder and add a
COLCON_IGNORE
file to the mobo_bot_teleop package to prevent running teleop on the Raspberry Pi.cd ~/<ros_ws>/src/mobo_bot/mobo_bot_teleop touch COLCON_IGNORE
-
go back to the
src
folder of your <ros_ws> and download and setup theepmc_harware_interface
ros2 package for theL298N EPMC MODULE
cd ~/<ros_ws>/src git clone -b humble https://github.com/robocre8/epmc_hardware_interface.git
-
go back to the
src
folder of your <ros_ws> and download and setup theeimu_ros
ros2 package for theMPU9250 EIMU MODULE
cd ~/<ros_ws>/src git clone -b humble https://github.com/robocre8/eimu_ros.git
-
install rplidar_ros binary package
sudo apt install ros-humble-rplidar-ros
-
go back to the
src
folder of your <ros_ws> and download the opencv_ros_camera package, from robocre8, for working with the USB cameracd ~/<ros_ws>/src git clone -b humble https://github.com/robocre8/opencv_ros_camera.git
- cd into the root directory of your <ros_ws> and run rosdep to install all necessary ros package dependencies
cd ~/<ros_ws>/ rosdep install --from-paths src --ignore-src -r -y
-
check the serial port the connected sensors and motor controller
The best way to select the right serial port (if you are using multiple serial device) is to select by path
ls /dev/serial/by-path
you should see a (if the module is connected and seen by the computer), your serial port would be -> /dev/serial/by-path/. for more info visit this tutorial from ArticulatedRobotics
for the EPMC (i.e L298N EPMC MODULE), go to the
mobo_bot/mobo_bot_description/urdf/
epmc_ros2_control.xacro
file and change theport
parameter to the port value gottenfor the EIMU (i.e MPU9250 EIMU MODULE), go to the
mobo_bot/mobo_bot_base/
eimu_ros_start_params.yaml
file and change theport
parameter to the port value gotten. you can also change thepublish_frequency
to maybe 20Hzfor the Lidar, go to the
mobo_bot/mobo_bot_base/launch/
robot.launch.py
file and change theserial_port
parameter for the lidar Node to the port value gotten.lidar_node = Node( package='rplidar_ros', executable='rplidar_node', name='rplidar_node', parameters=[{'channel_type': 'serial', 'serial_port': '/dev/serial/by-path/platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.1.2:1.0-port0', 'serial_baudrate': 115200, 'frame_id': 'lidar', 'inverted': False, 'angle_compensate': True, 'scan_mode': 'Sensitivity'} ], condition=IfCondition(use_lidar), remappings=[("/scan", "/lidar/scan")], output='screen' )
for the USB Camera, the video port no, which is by default 0, and every other should be okay.
But if you still intend to adjust anything, go to themobo_bot/mobo_bot_base/launch/
robot.launch.py
file to change any of the camera parameterscamera_node = Node( package='opencv_ros_camera', executable='camera_publisher', name='camera_publisher', output='screen', parameters=[{'frame_id': "camera_optical", 'port_no': 0, 'frame_width': 320, 'frame_height': 240, 'compression_format': "jpeg", # you can also use "jpeg" 'publish_frequency': 30.0} ], condition=IfCondition(use_camera), )
-
build your <ros_ws>
cd ~/<ros_ws>/ colcon build --symlink-install
-
don't forget to source your <ros_ws> in any new terminal
source ~/<ros_ws>/install/setup.bash
Note
You can further edit the parameters of the .yaml files in the mobo_bot_base package config folders
Clone and Build The MoboBot packages on your dev-PC connected (via ssh) to the Raspberry PI on the MoboBot robot
- pls follow the mobo_bot_sim tutorial for dev-PC
- you'll be using the mobo_bot_rviz package on your dev-PC to visualize the robot.
Run all these tests to check if any sensor or hardware gives any error.
- to test the EPMC Motor Controller (and the rsp with base control), run the following
ros2 launch mobo_bot_hw_test epmc_test.launch.py
- to test the EIMU Module, run the following
ros2 launch mobo_bot_hw_test eimu_test.launch.py
- to test the Lidar, run the following
ros2 launch mobo_bot_hw_test lidar_test.launch.py
- to test the USB Camera, run the following
ros2 launch mobo_bot_hw_test camera_test.launch.py
Note
If any error occurs, first unplug the lidar (from the USB HUB) and plug it back then unplug the USB HUB from the Raspberry Pi Port and plug it back. Everything should now work.
- on the Raspberry Pi 4b, open a new terminal and start the mobo_bot_base
source ~/<ros_ws>/install/setup.bash ros2 launch mobo_bot_base robot.launch.py
Note
If any error occurs, first unplug the lidar (from the USB HUB) and plug it back then unplug the USB HUB from the Raspberry Pi Port and plug it back. Everything should now work. launch the mobo_bot_base again
- on Your dev-PC, open a new terminal and start the mobo_bot_rviz by running
source ~/<ros_ws>/install/setup.bash ros2 launch mobo_bot_rviz robot.launch.py
You should now see the robot visuals on your dev-PC
- on your Dev PC, in a different terminal, run the mobo_bot_teleop to drive the robot around using the arrow keys on your keyboard
OR
source ~/<ros_ws>/install/setup.bash ros2 run mobo_bot_teleop mobo_bot_teleop
source ~/<ros_ws>/install/setup.bash ros2 run mobo_bot_teleop mobo_bot_teleop <v in m/s> <w in rad/sec>