This is a fun implementation of Catch and Catch game done using ROS Turtlesim.
Initially a turtle will be there which is the catcher of the game. A new turtle will be spawned to which the catcher will go to the goal position to catch it. Everytime we catch a turtle a new turtle is spawned in a random position. This process repeats continuously.
- Locating random positions
- Spawning new turtle
- Identifying distance
- Equating the distance
- Killing the turtle
- > random.randrange()
- >Turtle_spawn(goal,killer_name,spawn_name)
- The distance between the spawned turtle and the catcher turtle is found using the function
- Equating the distance between the turtles with the tolerance level, the linear and angular velocities of the turtle is changed simultaneously
- >Turtle_kill(killer_name)
This function can output a random value between the range of value we give it as a input. So by using this we can locate and spawn a turtle in random positions of the turtlesim workspace.
By using this function we can create a new turtle anywhere in the screen according to our inputs. The inputs are
goal = position
killer_name and spawn_name
So the turtle will be spawned at the goal position with the name of spawn_name
>euclidean_distance(self, goal_pose)
>while self.euclidean_distance(goal_pose) >= float(distance_tolerance):
With that the turtle moves for catching the new turtles
This function is used to kill the turtle whose input parameter is the name of the turtle. Once the catcher turtle catches the newly spawned turtle, then the Turtle_Kill function is been called
>self.Turtle_kill('turtle2')
You can also view the result here.