For simplicity, our tutorial applications include only the X and Y coordinates for your customers and do not include the angle TurtleBot should face when it arrives at the customer’s location. Keep in mind that ROS is developed for robots that work in 3D environments like drones. Therefore, orientation isn’t represented with a single angle. For those who want to take their application to the next level and allow custom angles, here are some tips:
If we view coffee_bot.py’s code search for “Quaternion”, this is what controls your orientation (aka: the angle). Let’s modify our code to accept one value. We will use degrees because your customers will likely understand this better than radians. The degree value is relative to the map that you load into amcl_demo.py.
Add two additional includes to your scripts:
Now we are going to convert the degrees value to radians, creating an Euler angle which we’ll then convert into a Quaternion. Basically, we need to take a few steps to convert degrees to the format that ROS wants.