Code Monkey home page Code Monkey logo

turtletolocation's Introduction

TurtleToLocation

This is an mini project to demonstrate my ability to generate a Turtle Robot that can autonomously make it's way to a given location.

Part 1: Create some code for turtle to be able to directly move to the a given location.

  • Get initial rotation, trajectory and distance abiliy from current location to coordinate location

SETUP

This assumes you have docker installed on your machine. https://docs.docker.com/get-docker/ And that xQuartz is appropriately installed and running to allow visual tools to be displayed.

A guide to set up xQuartz appropriately can be found in Steps 1-3: https://desertbot.io/blog/ros-turtlesim-beginners-guide-mac

Step 1: Spin up a new docker container

Spinning up a Docker container for ros noetic build

In your terminal set up a docker instance for the project. in this case the name of the project is rosproject

docker pull ros
docker run -e DISPLAY=host.docker.internal:0 --name rosproject -it ros:noetic-ros-core bash -v

Step 2: Accessing docker container

You are most likely already inside of the docker container if you're seeing something along the lines of

root@db5ef5c82850:/# 

If not then enter the docker container from your terminal. (note: if you have named your project differently to rosproject, make sure to enter the appropriate name)

docker exec -it rosproject bash

this will be important later on when you will need to open up multiple container windows

  • note: if you're outside of your continer, to display the available docker containers on a new terminal run docker ps -l
(base) omro@Omars-MacBook-Pro-6 ~ % docker ps -l
CONTAINER ID   IMAGE                 COMMAND                  CREATED          STATUS          PORTS     NAMES
1fc98c8ed6cc   ros:noetic-ros-core   "/ros_entrypoint.sh …"   10 minutes ago   Up 10 minutes             rosproject

Step 3: Run the first time setup

Once you're inside the docker continer, run the first-time-setup.sh bash script to install all the relevant depancies for the project. (make sure to be in the correct directory)

sudo apt get git
git clone https://github.com/Olseda20/TurtleToLocation.git
cd /TurtleToLocation
./first-time-setup.sh

Testing the Work

Before Proceeding, make sure you are inside of the correct directroy and for the sake of convenince, if you open up a new terminal tab accessing the container, made sure to make your way back to this directory.

If you aren't there, you can run.

cd /TurtleToLocation

1- Testing

To ensure the environment is appropriately set up and the Position and Motion methods are working. Please run the Provided tests ensuring they all pass.

In a new terminal window that is (currently accessing the rosproject docker container) run the 2 provided tests.

Position Tests

pytest PositionTests.py

successful results look like

image

Motion Tests

pytest MotionTests.py

successful results look like

image

2- Running the move to goal script

Once you're happy the tests are running. Open up 2 more terminal windows (total of 3 windows accessing the docker container).

1st window: roscore

run roscore to ensure a master is running

roscore

2nd window: turtlesim

run the turtlesim to visualise the motion

rosrun turtlesim turtlesim_node 

3rd window: testing functionality

this will be where you will test the move to goal functionality you should run the MoveTurtle.py script with 2 positional arguments which will make up a set of coordinates eg (8 9)

python3 MoveTurtle.py.py 8 9

you should see the turtle moving towards the provided coordiante location. image

Next Parts of this project

I would start to incorporate some sort of Mapping/GPS API to identify a gps location of a given turtle. https://github.com/googlemaps/google-maps-services-python this could solve a lot of the path planning issues associated by making use of pre-existing solutions to this particular problem.

Positionally, rather than using the Pose Data from the turtle1/pose node, I would instead look to identify the coordinate location using GPS. Along with the coordinate location of the turtle, I would do something similar for the coordinate location of the Desired location (Greenwhich?)

Initially, I would making use of the same methods generated in this project to move the turtle towards the location using the same motion.

On success of this I would start thinking about the process of making use of waypoints built into that api. I would think about the checkpoints a person might need to make while walking this route, or a car driving, split it up into appropriate sections, and still using the same motion system, move towards to split checkpoint locations.

Resources:

turtletolocation's People

Contributors

omroali 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.