This package comprises a pygame-based robot simulation for a kobuki robot.
sudo apt install python3-pip
pip install pygame
Tests have been performed with ROS melodic, albeit the used python versions differ. While ROS melodic uses python2.x, the simulator need python3. The reason is, that ROS noetic will require python3. In order to make the simulator work with ROS melodic, you can follow the installation hints below.
Installing python3 aside python2 can be done with pip:
user@machine:~$ sudo apt install python3 python-pip python3-pip python-catkin-tools
user@machine:~$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
user@machine:~$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2
user@machine:~$ pip install -U defusedxml rospkg pygame pycryptodomex gnupg pyside2 pydot numpy
Go to your catkin workspace and build the package. / execute the following commands (replace the path to your catkin workspace accordingly):
user@machine:~$ cd ~/catkin_ws
user@machine:~/catkin_ws$ catkin_make
user@machine:~/catkin_ws$ source devel/setup.bash
user@machine:~$ cd ~/catkin_ws
user@machine:~/catkin_ws$ catkin build ohm_kobuki_sim
user@machine:~/catkin_ws$ source devel/setup.bash
If you installed all dependencies and built the package without any errors, you should be able to launch the simulator using the following command:
user@machine:~/catkin_ws$ roslaunch ohm_kobuki_sim simulator.launch
A window should pop up that displays the environment, the robot and ray-traced laser beams:
Name | In/Out | Type |
---|---|---|
/kobuki/cmd_vel | In | geometry_msgs/Twist |
/kobuki/laser | Out | Sensor_msgs/LaserScan |
/kobuki/odom | Out | nav_msgs/Odometry |
/kobuki/wheel_speed | Out | ohm_kobuki_sim/WheelSpeed |
The simulator listens to velocity commands, as published by e.g. the teleop_twist_keyboard tool. To publish them manually, you can use the following command:
rosrun teleop_twist_keyboard teleop_twist_keyboard.py cmd_vel:=/kobuki/cmd_vel
We provide a Gmapping configuration for our simulator to create a map of the environment.
roslaunch ohm_kobuki_sim kobuki_gmapping.launch
This command should open up an RVIZ window with our view that shows the mapping progress:
If you encounter errors, you might need to install gmapping:
sudo apt install ros-noetic-gmapping