Lab 2 Part 1 will ask you to program your robot to perform a few maneuvers using open loop control. The instructions at the end of this assignment are one way to do this but not the only way. You will be graded on whether your code, demo, and other submissions meet the specifications below, not on following the instructions exactly.
This lab requires that you create:
The goal of this part of the lab is for you to develop a ROS node that estimates robot odometry on the Duckiebot. This odometry will not be exact because the robot will not do exactly what we tell it to do, but let’s try to get close. In this lab, you should:
Each student should submit a PDF (can be identical for both lab partners) to Blackboard with the following information:
Demonstrate the pattern in class.
Submit a PDF to Blackboard with the following information.
Demonstrate the odometry of your square pattern in class.
5 points: Package creation
25 points algorithm
10 points accuracy at first corner (-1 point for every 12.5 cm from corner)
10 points accuracy at second corner (-1 point for every 25 cm from corner)
20 points running same commands again to complete square (not graded on accuracy)
10 points starts when A is pressed in keyboard control, stops when S is pressed.
20 points: Answers to questions
15 points Algorithm
20 points Accuracy in demo (measured versus actual position, different from Part 1)
15 points: Accuracy as reported by student
$ chmod +x <node_name>
<launch>
<group ns="$(env VEHICLE_NAME)">
START YOUR NODE HERE
</group>
<include file="$(find anti_instagram)/launch/anti_instagram_node.launch">
<arg name="veh" value="$(env VEHICLE_NAME)"/>
</include>
<include file="$(find line_detector)/launch/line_detector_node.launch">
<arg name="veh" value="$(env VEHICLE_NAME)"/>
</include>
<include file="$(find lane_filter)/launch/lane_filter_node.launch">
<arg name="veh" value="$(env VEHICLE_NAME)"/>
</include>
<include file="$(find ground_projection)/launch/ground_projection_node.launch">
<arg name="veh" value="$(env VEHICLE_NAME)"/>
</include>
<include file="$(find led_emitter)/launch/led_emitter_node.launch">
<arg name="veh" value="$(env VEHICLE_NAME)"/>
</include>
<remap from="fsm_node/set_pattern" to="led_emitter_node/set_pattern"/>
<include file="$(find fsm)/launch/fsm_node.launch">
<arg name="veh" value="$(env VEHICLE_NAME)"/>
<arg name="param_file_name" value="lane_following"/>
</include>
</launch>
This will start your node inside the namespace for your robot. Keep <group ns=”$(env VEHICLE_NAME)”> EXACTLY as shown above, it will find your vehicle name.=
$ dts devel build -H <duckiebot_name>.local --pull
The first time this command runs it may take a while. To get some additional feedback, you may want to run this first to download the core docker containers.
OPTIONAL COMMANDS BELOW
$ docker -H <duckiebot_name>.local pull duckietown/dt-core:daffy-arm64v8
$ dts devel run -H <duckiebot_name>.local -s -M --cmd bash
The -s flag copies your repo to the /code folder on the robot so that it can be mounted by the -M flag and you do not need to rebuild for every small change. It is unlikely that you will have to rebuild during this lab.
$ dts start_gui_tools <duckiebot_name>
to figure out what is going on using standard ROS tools.
There are two ways to complete this lab, depending on if you have a DB18 or a DB19/DB21:
DB18 (and later models if desired): Assume that the vehicle is performing the commands exactly as ordered and integrate the wheel velocities provided by the topic.
wheels_driver_node/wheels_cmd. This approach can also be done on the DB19/DB21, it is your choice. You will need to perform some experiments to determine the correspondence between the numbers given here and the actual speed of the wheels. It is highly unlikely that 1 unit of velocity input to the robot is exactly 1 m/s in the real world!
DB19/DB21: Use the wheel encoder data provided by left_wheel_encoder_node/tick and right_wheel_encoder_node/tick. You will need to find the correspondence of ticks to each wheel movement in real-life. You will then need to record each tick as they come in and, likely using a timer. Calculate odometry using both.
Find the correspondence between the data from the Duckiebot (using either method) and real-world measurements. Drive your robot around and record how the values change. You may find that the size of your wheels and the baseline distance between the wheels is important. You can use keyboard control or directly publish to the command topic to make your vehicle drive at a constant speed.
When you complete your node, test it thoroughly. You may find that the robot has a consistent bias in one direction or another. You may need to add a scaling factor to one or more components of the input or output. You are free to do this, as long as the same scaling factors are present in all trials.