Goal: To find QR codes in an office environment
Launch the simulation with the following command:
roslaunch final_project turtlebot3_world.launch
It should open gazebo where you can manually explore and inspect the environment your robot will be navigating. As you will see, there are a number of barriers (see example below) that will spawn in random locations around the room. The barriers are unknown obstacles that any robot has to avoid. Additionally, 5 QR markers are also spawned randomly in the environment which you will be using according to the project description.
There are a few parameters for launching the environment you can use when you are developing.
- enable_robot (default true): Will spawn the robot in the environment at launch
- enable_competition (default true): Will spawn both the random barriers/obstacles and QR-markers
- layout (default 0): Specifies the layout of the QR markers. You can use this to ensure the QR-markers are always spawned in the same location (e.g. when debugging). Can be either 0 (random), 1, 2, 3, or 4. Note that for the project you hand in, the layout will be 0 and thereby random!
- gui (default true) & headless (default false): Gazebo is launched with a graphical user interface. You may choose to disable this GUI in favor of computational power and only visualize through other tools such as rviz.
An example that will launch the simulation with a robot, but no QR markers or obstacles/barriers:
roslaunch final_project turtlebot3_world.launch enable_competition:=false
QR markers and obstacles can then be spawned manually with:
roslaunch final_project spawn_markers.launch
roslaunch final_project spawn_obstacles.launch
As we have seen in this course, one of the major advantages of using ROS, is that as long as the interface (i.e. topics) match, we can reuse previous tools very easily! Use the same navigation package you have used previously in the course to navigate our new robot. With the navigation running, open rviz in another terminal:
rviz
In RViz add the topics that are seen in the screenshot above.
Now you should be able to navigate the robot by pressing the "2D Nav Goal" button in RViz and then pressing somewhere on the map.
Obviously you'll need to be able to read the QR markers used for the project. First install the following:
sudo apt install ros-melodic-visp-auto-tracker*
Run the command:
roslaunch final_project qr_visp.launch
A new window should now open showing the camera output from the robot. When the QR code is close enough you should see an image like this:
The readings are being published to the topic /visp_auto_tracker/object_position and /visp_auto_tracker/code_message, so you can check if the code is reading by running the following command in a new terminal window:
rostopic echo /visp_auto_tracker/object_position
rostopic echo /visp_auto_tracker/code_message
To run our navigation script, run the following command:
rosrun final_project scripts/find_markers.py
To understand the project goal of the project we present here an example pipeline for solving the problem. The robot could:
- “Manually” map the area (you can teleoperate ONLY for this step).
- Start exploring the area until a QR target is found
- Find a second QR target,
- Use the “hidden” frame of reference to locate the rest of the target’s frame of reference.
- Construct the “secret message” sentence by concatenating the strings from all detectedtargets in the correct order (from 1 to 5)
roslaunch final_project turtlebot3_world.launch
rviz
rosrun teleop_twist_keyboard teleop_twist_keyboard.py
roslaunch final_project qr_visp.launch
rostopic echo /visp_auto_tracker/code_message