Git Product home page Git Product logo

turtlesim_catch-and-catch's Introduction

Turtlesim_CatchAndCatch

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.

github_crop

Flow of program


  • Locating random positions

  • Spawning new turtle

  • Identifying distance

  • Equating the distance

  • Killing the turtle

  1. Locating random positions
  2. > random.randrange()
    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.

  3. Spawning new turtle
  4. >Turtle_spawn(goal,killer_name,spawn_name)
    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

  5. Identifying Distance
  6. The distance between the spawned turtle and the catcher turtle is found using the function
    >euclidean_distance(self, goal_pose)

  7. Equating the distance
  8. Equating the distance between the turtles with the tolerance level, the linear and angular velocities of the turtle is changed simultaneously
    >while self.euclidean_distance(goal_pose) >= float(distance_tolerance):
    With that the turtle moves for catching the new turtles

  9. Killing the turtle
  10. >Turtle_kill(killer_name)
    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')

Screenshot from 2021-06-30 14-39-58(1)

You can also view the result here.

turtlesim_catch-and-catch's People

Contributors

rakee003 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.