Giter Club home page Giter Club logo

software-team-entrance-task's Introduction

Software-Team-Entrance-Task

Introduction

This task aims to create a simple ROS2 node that receives the current GPS location and calculates the distance and heading between the current location and multiple target locations. Once these distances and headings are calculated, you must publish them to their respective topics with a custom message that meets our testing criteria.

Task Overview

To effectively operate our rover in the field, it's crucial to have the ability to calculate the distance and heading to objects of interest relative to the rover. This information is valuable for many applications such as aligning radio equipment and autonomous traversal. The responsibility of acquiring and publishing this information has fallen to you. Your task is to create a ROS2 node that performs this calculation and provides real-time updates to the rover's control system on the location of a communications dish based on the recieved position of the rover. Below you will find a breakdown of the critical components, requirements, and steps involved.

Workplace Structure

Within the ros_ws/src directory, we store all of our ros packages grouped by their respective subsystem. The workspace for this task has the following subsystems and packages:

  • Navigation - Contains all of the packages related to the localization of the rover

    • launch_nav - Contains the launch file that is used to launch all of the nodes related to navigation
    • GPS - Contains the node that is used to get the current GPS location of the rover (will not be used for this task as it needs a GPS module to work, instead you will be using testing/test_gps to simulate the GPS node)
    • gps_distance - You must make this package
  • testing - Contains all of the packages related to testing different nodes of the rover

    • launch_test - Contains the launch file that is used to launch all of the nodes related to testing
    • test_gps - Contains the node that will be used to test the node created for this task
  • interfaces - Contains all of the custom messages, services, and actions that are used within our workspace.

    • msg - Contains all of the custom messages that are used within our workspace.

Requirements

  • Do not build your package using symlink, if you do so the package will not build properly. If you do accidentally build using symlink, you can fix your build by deleting the build,install, and log files and rebuilding without symlink
  • Must use Ros2 Humble
  • Must be running on an Ubuntu 22.04 environment (can be a VM or WSL)
  • Your ros2 node can be created in Python or C++.
  • Your node must be added to the main launch file of the navigation subsystem (although you may launch your package using bash ros2 run.
  • Must use Git to clone the repository (you must make a local clone as your solution should not be public), and use commits to orgnize and label your changes. At the end you should zip the directory (turning it into a compressed file) and submit it to the google fourms submission link below.

Task Breakdown

1. Creating a ros package

Firstly create a new ros package within the ros_ws/src/Navigation directory, this package should be named gps_distance.

2. Subscribing to current GPS location

Your node will receive NavSatFix messages over the "GCS" topic, only the latitude and longitude fields are populated. You may gain some insight into the structure of the message by running bash ros2 topic echo "GCS" after the launch_test script has been launched using bash ros2 launch lauch_test launch.launch.py.

Basic Pub/Sub

3. Calculating distance and heading

The formula you will use for the arithmetic is called the Haversine formula for distance, this formula is used to compute the great-circle distance between two points on a sphere. You are not allowed to use an existing Python package to do this calculation for you. An important consideration for the distance calculation is that the earth is not a perfect sphere, for this task, it will be assumed that we are operating at CIRC Summer which is held in Drumheller Alberta. The radius of the earth at the operating site should be assumed to be 6365.766km. This radius is the sum of the altitude and radius for a given latitude. Additionally, in order to calculate the heading you may use the following function and add it to your code:

def get_heading(longitude, latitude):
  lat1 = radians(longitude)
  lon1 = radians(latitude)
  lat2 = radians(43.78522077857844)
  lon2 = radians(-79.50167502538869)

  delta_lat = lat2 - lat1
  delta_lon = lon2 - lon1

  y = sin(delta_lon) * cos(lat2)
  x = cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(delta_lon)
  bearing = atan2(y, x)
  bearing = degrees(bearing)
  bearing = (bearing + 360) % 360
  heading = round(bearing, 1)
  return heading

Key constants

  • Dish 51.42287924341543,-112.64106837507106
  • Radius 6365.766km

4. Publishing distance and heading (with custom message)

Your output should be published to the “Dish” topic for every pair of GCS coordinates individually as they are received. The format of your custom message must meet the message specifications exactly, otherwise, your work will not be able to be checked by the check node. The message should consist of four float64 fields named as follows “latitude”, “longitude”, “distance”, and “heading”. Where the “latitude” and “longitude” are the GCS coordinate pair of the rover received on the topic “GCS”, “distance” is the distance in meters rounded to one decimal point between the received rover GCS pair and the fixed dish coordinates (51.42287924341543,-112.64106837507106). “Heading” is the heading of the dish from the rover, this heading is measured in degrees off of true north rounded to one decimal point (once you have implemented the Haversine formula for calculating distance, it should become more obvious on how heading should be computed)

Basic Pub/Sub

The custom message must be named "Completed.msg", located under ros_ws/src/interfaces/msg, and must follow the format described above. There are more steps involved in adding a custom message, a good tutorial can be found here.

5. Adding your node to the launch file

Now that you have created the node, you must add it to the Navigation package launch file. The launch file should be named launch.launch.py and should be located within the ros_ws/src/Navigation/launch directory. There are additional steps when it comes to adding nodes to launch files other than editing the launch file itself, refer to the official documentation.

6. Testing

In order to test your node, you must launch both your launch file and the launch_test file. These should be launched in separate terminals.

bash ros2 launch launch_test launch.launch.py

bash ros2 launch {yourlauchpackage} {yourlaunchfile}

You should receive feedback in the terminal you ran launch_test in. This feedback is limited to message issues. If you are not receiving any messages from the check node in the terminal you ran launch_test in, it's likely you aren't publishing to "Dish". You may run bash ros2 topic echo "Dish" in a separate terminal to be sure.

Submission

Once you have completed the task, you must submit your solution to the task by filling out the following form: YURS Software Entrance Task Submission

Deliverables

  • A link to a zip file (compressed file) that contains the repository holding your solution to the task (must have your changes orginized as commits), the repo should contain the following:
    • A ros package named gps_distance within the ros_ws/src/navigation directory
    • A node within the gps_distance package that subscribes to "GCS" and for each GCS coordinate pair publishes the appropriate message to the "Dish" topic.
    • A launch file within the ros_ws/src/Navigation/launch directory which launches your node.
  • A link to a video of the output of the launch file created for this task. The video should show the terminals in which you launched the test launch file and your own, as well as the rqt_graph

software-team-entrance-task's People

Contributors

filippyork avatar karanpreetraja avatar

Stargazers

 avatar Abhay avatar Klodiana Kamberi 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.