Here will be scripts, sources and other files for performing vSLAM on Turtlebot in Gazebo environments. Now here is script turtlebot_mover.py
which contains code for moving Turtlebot in simulated environments by direct setting its coordinates.
- Linux-based system with ROS installed
- ROS package
turtlebot3_gazebo
(can be found at https://wiki.ros.org/turtlebot3_gazebo) - Python 2.7 or higher
Turtlebot movement is performed with TurtlebotMover
class of script turtlebot_mover.py
.
This class has the following params:
name
- name of Turtlebot model in Gazebo. Default isturtlebot3
max_angular_speed
- maximum speed of Turtlebot's rotation (in rad/s). Without constraints, Turtlebot will be rotate with such angular speed. Default is 0.5max_linear_speed
- maximum speed of Turtlebot's movement (in m/s). In case of moving by line, or by circle with enough big radius, Turtlebot moves with this linear speed. Default is 0.5trajectory_type
- type of Turtlebot's trajectory. If this parameter is set asline
, Turtlebot rotates until it is directed to destination, then moves directly, along line. If this parameter is set ascircle
, Turtlebot moves along arc of circle until it is directed to destination, then moves directly, along line. Default isline
Movement is performed with move_to
method of the class. This method takes two float numbers - coordinates of the destination.
To move Turtlebot in Gazebo environments, make the following steps:
-
Start ROS core
-
In other terminal, choose Turtlebot model as
waffle_pi
:
export TURTLEBOT3_MODEL=waffle_pi
- Launch Gazebo with Turtlebot in some environment, for example,
turtlebot3_house
:
roslaunch turtlebot3_gazebo turtlebot3_house.launch
- In one more terminal, start Python and move Turtlebot using
TurtlebotMover
class:
from turtlebot_mover import TurtlebotMover
mover = TurtlebotMover(max_angular_speed=0.5, max_linear_speed=0.5, trajectory_type='line')
x = 0
y = 0
mover.move_to(x, y)
If you have many Pythons (for example, system Python and Anaconda Python), you may face with some Python errors. To fix these errors, set your PATH
system variable to satisfy ROS's python (for example, remove Anaconda from PATH
if your ROS is with system Python)