Description
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 http://wiki.ros.org/turtlesim 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: https://roboticsbackend.com/ros-param-yaml-format/ 3 As an example of a launch file you can see: https://riptutorial.com/ros/example/24423/launch-ros-nodes-and-load-parameters-fromyaml-file 4 You may use Kazam to record your screen in Ubuntu: https://www.linuxbabe.com/multimedia/install-kazam-screencaster 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. http://wiki.ros.org/turtlesim/Tutorials/Go%20to%20Goal b. https://github.com/BlakeStrebel/Figure-Eight c. https://sceweb.uhcl.edu/harman/A_CRS_ROS_I_SEMINAR/3_1ROS_I_Seminar_TurtlesimControl_1_2 3_2018a.pdf 2. Cheat-sheets: a. [ROS] https://w3.cs.jmu.edu/spragunr/CS354/handouts/ROSCheatsheet.pdf b. [TMUX] https://tmuxcheatsheet.com/ 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 https://github.com/sharif1093/eece5550_master.