Create an self driving self swimming autonomous turtle using the ROS turtlesim simulator.
Requirements: Answer
In this assignment, you will create an self driving self swimming autonomous turtle using the ROS turtlesim simulator. The goal of the assignment is to understand:-ROS nodes-ROS topics-ROS messages -ROS parameters and services -ROS launch filesAnd get familiar with:-ROS workspace-The catkin build system-Creating your own ROS nodes.
To get started:•Git pull to obtain the the autoturtle ROS package from: https://github.com/linklab-uva/f1tenth-course-labs •Link (or copy) the autoturtle package to the catkin workspace•Cp -a ~/github/f1tenth-course-labs/autoturtle/ ~/catkin_ws/src/•Run catkin_make in the catkin_ws folder. Source your environment.•Ensure the python scripts are executable: find . -name “*.py” -exec chmod +x {} ; •The node turtlesim_move.py has been provided for reference. •Make sure you can run the provided node successfully before attempting the remaining assignment:rosrun autoturtle turtlesim_move.py[should move the turtle towards the x direction until it hits the wall]Convert source files to Python 3 if using Noetic on ubuntu 20.04
Problem 1: Turtle Swim School
Problem 1a: swim_school.py1.Using the turtlesim_move.py as reference, create a new ROS node called swim_school.py2.Modify the code to demo the following:[1a demo:] Upon running the command rosrun autoturtle swim_school.py•User can input a linear (x) velocity in the range [2,6] (floating point allowed)•User can input an angular (z) velocity [1,3] (floating point allowed)•The turtle then swims in a figure 8 shape, using the velocity and angular rate specified by the user. •There should be no other lines or traces in the ocean other than what has been asked in that problem[20 points]
Problem 1b random_swim_school.py1.Create a new ROS node random_swim_school.py[1b demo:]Upon running the command rosrun autoturtle random_swim_school.py-A random figure 8 is drawn in the ocean:-Turtle moves with a random linear velocity and a random angular velocity which is chosen every time the node is run. Use the same input range as problem 1a.-In addition, the figure 8 is drawn at a random position during each run. Its fine if the figure 8 hits the turtlesim ocean boundary.-The center position (x,y) of the random figure 8 is displayed on the terminal. -There should be no other lines or traces in the ocean other than what has been asked in that problem[20 points]
Problem 1c: back_to_square_one.py1.Using the turtlesim_move.py as reference, create a new ROS node called back_to_square_one.py2.Modify the code to demo the following:1b demo: Upon running the command rosrun autoturtle back_to_square_one.py•User inputs the length of the side of the square (number between 1 and 5, any number including floating points is allowed.) •The ocean turns red •A square is drawn with the length of the side of the square equal to the user input.•Note the square must be traced/drawn as the turtle swims…DO NOT use teleport absolute or relative to draw the square instantaneously.•The bottom left corner of the square is always at (x,y) = (1,1), theta could be anything you want.•You may useteleport relativeto turn better.•There should be no other lines or traces in the ocean other than what has been asked in that problem[30 points]
Problem 2: Swim to goal
Problem 2: swim_to_goal.py1.Create a new ROS node called swim_to_goal.pyDemo the following:-User inputs the x coordinate for the goal: (e.g. 1)-User inputs the y coordinate for the goal: (e.g. 1)-User inputs a ‘tolerance’ value (defined in subsequent slides): (e.g. 0.1)-The turtle swims (not teleports) to the goal with a velocity and angular rate, proportional to the distance between the current position and the goal. -During the demo show and interpret the rqt_plot for the velocity and angular rate for this system[30 points]
Problem 2: What should node execution look like ? User enters x, y, goal, and a tolerance value.
Problem 2: What should the output look like ?
Problem 2: swim_to_goal.py – HintsWhat does proportional velocity and angular command mean ?Proportional speed and turning:Velocity x = V_gain * (Euclidean distance between position at any time and the goal)Angular z = A_gain (atan2 (ratio of y component to x component))The gains are constant but the velocity and angular rate will change as the turtle moves towards the goal, since the distance between the position of the turtle and the goal is always decreasing.
Tolerance is a constant which dictates how close does the turtle need to be to the (x,y) goal before it is considered that it has reached the goal.The tolerance is needed since the pose messages that turtlesim echoes is usually a floating point value.A good value for the tolerance is between 0.1 and 1.A useful command in python to use for dealing with pose data is:round(number[, ndigits])
Useful declarations for these problems are:import rospyfrom geometry_msgs.msgimport Twistfrom turtlesim.msg import Posefrom math import pow, atan2,sqrt
What do I have to submit ?-All the ROS nodes you create should be inside the /autoturtle/scripts directory. (The same as the turtlesim_move.py script).-Compress the entire /autoturtle folder.-Rename the compressed file to <your_computing_ID>_<ROS_distribution_name>.zip and submit on Collab. Only submit a single zip file. Example: mb2kg_melodic.zip-Ensure, the code you are submitting does not throw any errors during a catkin_make.
-We will un-compress your submitted folder inside the src folder of our catkin workspace and run catkin_make. -We will then test your code with the following commands and correct input ranges:-rosrun autoturtle swim_school.py-rosrun autoturtle random_swim_school.py-rosrun autoturtle back_to_square_one.py-rosrun autoturtle swim_to_goal.py
Launch file for each problem.There are 4 problems in this assignment:For each problem, create and use a launch file to demonstrate that problem (i.e. you create the appropriate node, but use a launch file for each problem to launch the relevant nodes for that problem).These files should be included in the autoturtle/launch subdirectory in your submission. Each launch file is worth 10 points (bringing the total points for this assignment to 140).
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Get ZERO PLAGIARISM, HUMAN WRITTEN ESSAYS
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.