EECE 5550 Mobile Robotics Homework Assignment 1 solution


Original Work


5/5 - (7 votes)

The goal of this homework is to make you familiar with ROS programming. This is pursued through implementation of the trajectory tracker presented in the class. Problem definition We have a tri-cycle with differential rear wheels and a front castor wheel. The goal is to implement a trajectory tracker to follow a given trajectory. The inertial frame is defined as ๐‘œ0๐‘ฅ0๐‘ฆ0๐‘ง0 and the robot frame is defined as ๐‘œ1๐‘ฅ1๐‘ฆ1๐‘ง1. The robot configuration vector is defined as ๐‘ž(๐‘ก) = [๐‘ฅ ๐‘ฆ ๐œƒ] ๐‘‡ where ๐‘ฅ, ๐‘ฆ, and ๐œƒ are elements of robot position in the inertial frame. At time ๐‘ก = 0 the robot is located at ๐‘ž(0) = [๐‘ฅ0 ๐‘ฆ0 ๐œƒ0] ๐‘‡ . The goal is to asymptotically follow the desired trajectory which is given as ๐‘Ÿ = {(๐‘ฅ๐‘‘ (๐‘ก), ๐‘ฆ๐‘‘ (๐‘ก))|๐‘ก = 0,1,2, โ€ฆ }. The desired robot configuration is formed based on the trajectory as ๐‘ž๐‘‘ (๐‘ก) = [๐‘ฅ๐‘‘ (๐‘ก) ๐‘ฆ๐‘‘ (๐‘ก) ๐œƒ๐‘‘ (๐‘ก)] ๐‘‡ . Design and implement a controller in ROS that gets the trajectory ๐‘Ÿ as an input parameter and controls the robot so it converges to the desired trajectory and follow it. The results should be demonstrated using the turtlesim1 simulator in ROS. Figure 1 โ€“ Illustration of the mobile robot on a 2D plane. ๐‘’๐‘ indicates the error vector between current robot state and desired robot state. Follow these steps to form a solution: 1. Create a catkin workspace and initialize it. 2. Create a package with rospy dependency and name it โ€œtraj_trackerโ€. 3. Create a python node named โ€œscripts/tracker.pyโ€ and implement the basics of a python node structure. 4. Run catkin_make for your catkin workspace and source the relevant setup file. Make sure that your catkin workspace is visible to ROS by checking rospack profile command output. Try running your node and make sure there are no issues. 1 5. Create a YAML file which includes the information for the input trajectory. Name the trajectory โ€œconfig/traj_1.yamlโ€ in your project. The format of the YAML file2 should look like: list_of_x: [๐‘ฅ๐‘‘0, ๐‘ฅ๐‘‘1, โ€ฆ , ๐‘ฅ๐‘‘๐‘›] list_of_y: [๐‘ฆ๐‘‘0, ๐‘ฆ๐‘‘1, โ€ฆ , ๐‘ฆ๐‘‘๐‘›] timestep: ๐‘‘๐‘ก where ๐‘ฅ๐‘‘๐‘– and ๐‘ฆ๐‘‘๐‘– with ๐‘– = 1, โ€ฆ , ๐‘ are the desired trajectory points. Also, ๐‘‘๐‘ก is the timestep for the desired trajectory. Populate the list_of_x and list_of_y for a square trajectory. The global coordinates of the square vertices are {(3,3), (8,3), (8,8), (3,8)}. The trajectory should be 10 times a single square trajectory. The overall duration of the trajectory (for all the 10 times of tracking) should be 60 seconds. 6. Create a launch file3 named โ€œall.launchโ€ which reads โ€œconfig/traj_1.yamlโ€ into a parameter named โ€œtrajectory_descriptionโ€ and runs the โ€œscripts/tracker.pyโ€ node. 7. Modify your node to read the โ€œtrajectory_descriptionโ€ parameter and print it on the screen, then exit. Run the launch file and make sure there no issues up to this point. 8. Modify the launch file to run the turtlesim simulator as well. This simulator is in turtlesim package and is named turtlesim_node. Run the launch file and make sure it works. 9. Use rostopic list to find the topic that is used for publishing input velocity messages for the turtle simulator. 10. Make your python node populate random messages into the topic you just found. Run the launch file, and everything should work fine together. 11. Implement the trajectory tracker and publish control inputs to control robot trajectory. To get robot pose as feedback you should subscribe to the corresponding topic. 12. Use the error norm to set the color of the turtle track using the set_pen service of the turtlesim. The color should range from pure red when turtle is far from desired trajectory to pure white when exactly following the desired trajectory. 13. Play with the controller parameters and see the results. Choose the best controller parameters. Deliverables: Create a zip file of all of the deliverables and upload them on Blackboard. The name should be: โ€œ___hw1.zipโ€ 1. A two-page report which describes the project, how the source is run, what it does exactly, etc. 2. The project source files. Compress it and name it โ€œsource.tar.gzโ€. 3. Simulation results for 5 different starting points (center, top-left corner, top-right corner, bottom-left corner, bottomright corner). For the top-left corner as the starting point, also do the simulations for 3 different controller parameters (5+3=8 simulations overall). 4. A video of the robot doing all the above simulations4 . Names should be set as โ€œ.mp4โ€ for the first 5 simulations where โ€œโ€ is a placeholder for the starting position and โ€œparam_set_.mp4โ€ for the last three simulations. Define the parameter sets you have used in your report. 5. Plots of the robot configuration (๐‘ฅ, ๐‘ฆ, ๐œƒ) vs time for all the above simulations. Use the naming conventions of video files. 6. (Bonus: +10%) Create a trajectory of the course initials (MR for Mobile Robotic). There should be space between M and R letters and the robot should set the color off during the transition to R after finishing M (using set_pen service). The size of the M & R letters should be so that they fill the whole scene with a margin of 1 from all edges. 2 Visit the following for a reference for YAML file specifications: 3 As an example of a launch file you can see: 4 You may use Kazam to record your screen in Ubuntu: The overall time for the trajectory should be no more than 20 seconds. The robotโ€™s initial position should be set to the beginning of the letter M. Provide the video recording of the tracking. References: 1. Several online code bases and tutorials that might be useful: a. b. c. 3_2018a.pdf 2. Cheat-sheets: a. [ROS] b. [TMUX] Appendix A docker container will be used to evaluate your results. The docker simply has ROS Kinetic installed together with some basic packages. Your package may be tested using this docker container for assessment. It is advised to test your packages in the provided docker container to make sure it works. It is simple to bring-up the docker container; just follow the instructions at