Skip to content

Developing HERO

Rodrigo Martín Núñez edited this page Apr 23, 2024 · 8 revisions

Table of Contents

Code Hierarchy

In this section we will cover the most important repositories from HERO and how they interact with each other: There are many repositories and directories available that give the ability to HERO to perform all the tasks!. Since it might be confusing at first, here is an overview of some of the most important directories.

tue_robocup

RoboCup@Home challenge implementations This repository contains the high-level code that TU Eindhoven's AMIGO, HERO and SERGIO robots use to perform RoboCup@Home challenges.

Note: A challenge is a more complex set of tasks that the robot needs to perform during RoboCup (e.g. for "take out the garbage", the robot must navigate to the trashbins, pick up the trash from inside, and drop it outside of the arena.)

robot_skills

Provide interfaces to all parts of a robot (its base, arms, head, perception, worldmodel, speech system, etc.). A robot is represented via a robot-object which can be used by the robot_smach_states.

hero_skills

robot_skills specific for HERO robot

robot_smach_states

Library of, indeed, smach states and state machine, built using the SMACH state machine library from ROS. There are states concerning navigation, perception, world modeling/reasoning, complex and simple arm movements, speech recognition, and some more...

Here, each state has its different outcomes (e.g. for navigation state machines, the outcomes would be something like 'succeeded', 'arrived', 'blocked', 'preempted').

Each state is passed an instance of the Robot-class from the tue-robotics/robot_skills-package. The actions called via the robot_smach_states are implemented and executed via such a Robot-object.

Challenges

Their format is challenge_<name of challenge>. Higher level of code for each challenge. Each challenge is build using state machines from robot_smach_states and putting them together to make the robot do a more complex task.

HMI (Human Machine Interface)

This come in play whenever the robot is waiting for an answer (e.g. waiting for the someone to say its name). HMI then triggers all the different servers at once (speech recognition, QR code reader, ...) and waits for an answer. This then returns to the robot the first answer that the HMI servers process succesfully.

ED (Environment Descriptor)

This is a 3D geometric, object-based world representation system for robots. At the moment different ED modules exist which enable robots to localize themselves, update positions of known objects based on recent sensor data, segment and store newly encountered objects and visualize all this through a web-based GUI.

Hero_bringup

Launch, machine and parameter files required to bringup the HERO robot.

More...

There are also more specific packets such as image_recognition and more...

Managing the filesystem

To develop HERO you will need to know some useful commands to move around the filesystem and develop on all the repositories.

For developing our robots, we use Git version control. There are many tutorials in the internet on how to use Git and how it works. For the basics:

# Basic workflow to contribute to <repo>
roscd <repo>
git checkout -b "<name of new branch>" # Create a branch locally (will be published later)

# Develop your contribution in your IDE...

git add path/to/file  # Add your changes of a file (or your current directory by setting `.` as the filepath) 
                      # to git locally (you can add -p to review and select specific blocks of the file to add)

git commit -m "Commit message" # Commit your changes locally with a message, be very brief but descriptive
git push # Publish your changes to GitHub (You will be able to see your branch in GitHub)

# Create pull request when contribution is ready, see below for details

If installed correctly, all the repositories from tue-robotics will be located at: ~/ros/noetic/system/src/<repo>

To quickly go to a repository, you can run the command roscd:

roscd <repo>    # Example: roscd robot_skills
                # This will bring you to ~/ros/noetic/system/src/robot_skills

As you will probably create and work with many branches possibly in many repositories you have to checkout (change to) those branches individually for every repository that needs it. For this:

git checkout -b "<name of new branch>"       # Create a new branch in the current repository
git checkout "<name of existing branch>"     # Checkout to an existing branch in the current repository

You will also have tue-custom commands to keep eveything up to date and managing the branches, here is a quick overview:

tue-get update          # Updates all the repositories
tue-make                # Builds and installs all the packages

tue-status              # Useful to see what branches is each repository using, or to see local changes
tue-checkout <branch>   # Checkout all repositories to <branch>

Working with branches

When working with HERO, you first want to create a branch to push your changes to.

Branch naming

Try to follow this branch naming pattern to keep eveything organized:

feat      # New feature
fix       # Bug fix or improving code
challenge # For specific challenges
rwcYYYY   # Branches used for robocup (YYYY is the year)

So, for example you can have a branch named feat/grasping-cutlery.

If you create a PR early, make sure to mark it as a Draft.

PR Checklist

When a branch is ready to be merged, this is a general checklist you can follow to help you make sure you have developed everything correctly:

  • CI/CD passes
  • Code follows PEP-8 standard (you can use tools like black)
  • Has type hinting and function docstrings
  • PR description/commits are descriptive
  • Mentions other PR's that also have to be merged along this one