Generally commands to a robot can come from two different places, namely from an operator or a planner. These commands come in form of ideal linear and angular velocities that the operator or planner would like the robot to do. In 2D space these velocities are expressed by the
Teleoperation allows you to control robot manually. There many are many different ways do this, such as: keyboard, joystick, QT teleop, interactive markers. Our exercises will cover keyboard functionality that must be implemented in order to drive the robot around smoothly. The hole implementation will be done in the antrobot_key_teleop_node.py
script by following the TODO's in the file and the below exercise description. For building, running and testing the code consult the commands in the next section.
In this instance we are given a target
value (i.e. linear/angular velocity) which the robot can't instantly do. So, the objective here is to implement a __cmd_step__
method that will translate the target
to an output
that incrementally reaches the target in discrete steps. Each step has its own increment, or more formally a specific slope
. Identify the __cmd_step__(...)
method within the skeleton located in the antrobot_key_teleop_node.py
and complete its code.
Now that we can smoothly generate an output from a desired target we must ensure that target references issued by the operator or planner stay within the limits of what the physical system (i.e. the robot) can actually execute. Hence, you must implement the code for the __threshold__(...)
method which we later use to transform a target
value into an actual reference value that is within the two limits low_limit
and high_limit
(specified as the parameters of the function). Identify the __threshold__(...)
method within the skeleton located in the antrobot_key_teleop_node.py
and complete its code.
With the __threshold__(...)
method implemented we can ensure that a target is in the physical range of what the robot can do. Here you'll have to use it to
ensure that self.ref_linear_velocity
is within the limits of [-self.max_linear_velocity, self.max_linear_velocity]
. Identify the __set_ref_linear_velocity__(...)
method within the skeleton located in the antrobot_key_teleop_node.py
and complete its code.
As in exercise 3, here we'll have to ensure that the angular reference is within the physical range of what the robot can do. Identify the __set_ref_angular_velocity__(...)
method within the skeleton located in the antrobot_key_teleop_node.py
and complete its code.
By now, we have all that we need to translate our keyboard inputs to actual references. For this task use __set_ref_linear_velocity__(...)
/ __set_ref_angular_velocity__(...)
together with self.linear_step_size
/ self.angular_step_size
to increase or decrease the references for forward, backward, left, right motions. The keys that identify each motion, i.e. w, s, a, d
are already parsed for you in the run(...)
method. Identify the run(...)
method within the skeleton located in the antrobot_key_teleop_node.py
and complete its code for generating references for according to keys pressed.
- Building the project
To build the project you have to be located in the catkin workspace (i.e. ~/catkin_ws
)
and issue the command:
catkin_make
- Running your node
To run your teleoperation node you must issue the following command:
roslaunch antrobot_ros antrobot_teleop_key.launch
- Running a simulation
You can test your implementation with a simulated robot in Gazeboo environment:
roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch