Git Product home page Git Product logo

cvra / robot-software Goto Github PK

View Code? Open in Web Editor NEW
42.0 20.0 21.0 42.01 MB

CVRA monorepo - All software running on our bots lives here

License: MIT License

Shell 0.09% Makefile 1.03% C 67.85% C++ 11.63% GDB 0.01% Python 2.82% TeX 0.95% Jupyter Notebook 13.23% Dockerfile 0.01% SaltStack 0.11% CMake 2.18% Assembly 0.02% Starlark 0.02% Jinja 0.06%
eurobot robotics robotics-competition c embedded stm32 chibios robot can-bus uavcan

robot-software's Introduction

Robot software stack

Unit tests

STM32 builds

Raspberry Pi build

This repo contains all the software used on our robots:

  • can-io-firmware contains the firmware that runs on the IO board
  • motor-control-firmware contains the firmware that runs on the motor board
  • proximity-beacon-firmware contains the firmware that runs on the proximity beacon, it's the same code as the motor board but with a different application that is tailored to the needs of our proximity beacon module
  • master-firmware contains the software that runs on the master board, it interfaces all the other boards over CAN and runs the robot's "intelligence".
  • eurobot contains documentation and cofiguration files specific to the Eurobot competition
  • sensor-firmware contains code running on the sensor board
  • uwb-beacon-firmware contains code and documentation that runs on the UWB beacon board
  • hitl contains code to support Hardware In The Loop testing of the master board firmware.

Other important software components can be found in this repo:

  • lib contains all the libraries and building blocks we use on multiple boards, which includes:
    • lib/can-bootloader the bootloader that allows us to update our boards (IO and motor) over CAN
    • lib/ChibiOS the RTOS/HAL we use on all our boards
    • lib/uavcan the CAN communication library we use on all our boards
    • lib/error a logging library
    • lib/parameter a library to create and manage configurations of boards
    • lib/msgbus a publish/subscribe library for inter thread communication
    • and more.
  • tools groups all tools we use to develop on the robot including:
    • tools/pid-tuner a GUI to tune PID gains of motor boards over CAN, written using Python and Qt
    • tools/studio a set of introspection tools written in Python and Qt to debug our robots
  • uavcan_data_types contains the custom message definitions (DSDL) for the UAVCAN communication protocol
  • ci groups scripts and Docker files for our continuous integration server
  • user-guide contains high-level documentation about software and electronics components used on our robots

The user guide is generated using mdbook from doc/user-guide

Building with CMake

To build one platform with cmake, for example here our UWB beacon board:

mkdir build-uwb && cd build-uwb
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/uwb-beacon.cmake

# WARNING: Make all or make without target does not work.
make uwb-beacon-firmware.elf

# The resulting firmware is at `uwb-beacon-firmware/uwb-beacon-firmware.elf`.

To build the unit tests for all the boards:

mkdir build
cd build
cmake ..
make all test

Coding style

We use clang-format (tested with version 7 or greater) to enforce proper source code formatting. You can use the format-all.sh script in the root directory to format the whole source tree. You can also use clang-format -i --style=file src/foo.c to format a particular file. Finally, some editors include support for clang-format through plugin, check for yourself.

robot-software's People

Contributors

antoinealb avatar camgunz avatar francois-berder avatar froj avatar gawen avatar ievanavikiene avatar lu-ni avatar lyris85 avatar nikolaykasyanov avatar nuft avatar pierluca avatar rodrigosetti avatar stapelzeiger avatar syrianspock avatar wagdav avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

robot-software's Issues

Kernel Panic: scheduler priority assert

original Issue by @Stapelzeiger:

while running a bootloader ping through the master board it crashed at an assert at chsys.h:318.
The comment above the assert says:

The following condition can be triggered by the use of i-class functions
in a critical section not followed by a chSchResceduleS(), this means
that the current thread has a lower priority than the next thread in
the ready list.
ch.rlist.r_current has prio 3 (must be the TCP thread),
ch.rlist.r_queue.p_next is the uavcan thread and has prio 64

I quickly checked all use of I class functions in our code and didn't spot any obvious problems.
the two thread structures look ok, so no memory corruption of the thread working areas.

Color sequence detection [MVP1]

MVP1 should provide this behavior:
Given: The camera (with embedded computer) is rigidly mounted on a beacon spot
When: It is turned on
Then: It detects the position of the color sequence in the image, and determines the color sequence

  • Marker detection
  • Camera pose computation
  • Color sequence 3D->2D projection
  • Color segmentation
  • Display results

Fix opponent beacon in non-XY trajectory mode

Currently the beacon handling code assumes (incorrectly) that we are always moving in XY mode, but angle_* and d_* mode are very useful and we should handle them.

See: trajectory_helpers.c.

position_manager is not properly synchronized

We should add some locks around all operations manipulating positions. I personally believe it should not go in the module source code itself, but rather around every caller site.

Wire lever module

Wire lever module, includes:

  • 1 CAN IO board for the servo (with micro-switch)
  • 2 Motor boards for the pumps

Live telemetry display

The goal is to be able to visualize the state of the robot:

  • the map of obstacles
  • the position of the robot
  • the path found

The USB stack of ChibiOS may crash the firmware under certain circumstances

I hope you can tolerate my intrusion here, I'm just looking for friendly open source projects that leverage the ChibiOS's USB stack. The reason is that there appears to be a serious issue with the USB stack that may crash the OS under certain conditions; it is described here: http://www.chibios.com/forum/viewtopic.php?f=25&t=4568

So far the issue was observed on ChibiOS 16.1 running on STM32F105, STM32F373, and STM32F446. As can be seen in the linked thread, Giovanni is reluctant to take action until the issue is confirmed on newer revisions of the RTOS. Seeing as you're using version 17.6, perhaps you could spare half an hour to run a simple test described in the thread? That would be supremely useful for ChibiOS users in general.

Thanks!

Reimport motor board history

as discussed tonight the motor firmware needs to be reimported to preserve history and allow for easy git logging / bisecting. @nuft are you volunteer for doing it ?

Memory allocation problems

A memory related problem appeared recently when I tried to add support for additional motors on the bus (to support all motors in Debra's arms). This issue was not related to a specific motor but rather to the number of motor drivers used.

With the help of @Stapelzeiger @nuft, we successfully identified the issue in the motor driver where new failed because of lack of memory. A temporary fix is to free some place on the heap by reducing the size of trajectory buffers (from last year).

Long term solution:

  • Remove trajectory buffers as we don't use them anymore (they were meant for using the master board as IP-CAN relay)
  • Move thread stacks to CCM
  • Reduce obstacle avoidance internal buffer to accommodante enough obstacles for the competition, but not too much.

Two different logging subsystems

So we have something in log.h and something in aversive/error.h. One logging system should be enough for the whole robot I think ;)

I think Aversive's one is more feature rich, we can be both good and bad. In any case it should be cleaned up and maybe simplified (There are definitely some features we don't need).

What do you guys think ? Any reason to keep our own logger ?

I volunteer to cleanup/test/put everywhere Aversive's one should we decide to keep it by the way.

Studio: Improve setpoint publisher widget

The current setpoint publisher (part of cvra_studio pid_plot) was rushed, so it's missing some features:

  • The node is addressed by ID, should be by name through a list of available nodes
  • The setpoint should be either symmetric or not (alternate value and 0), currently it's symmetrically alternated only (positive/negative)
  • Dump config to yaml for easier PID tuning

Make better use of the touchscreen

The screens showed their potential for debug outputs when we used them as console. I think they can do much more, especially if we make use of their touch part. Then we could have real panels for things such as arm position, robot position, beacons, etc.

Wire new arm

Wire the new arm, includes:

  • 2 Motor boards for elbow and shoulder
  • 1 Motor board for the pump
  • 1 CAN IO board for the servo

Cleanup obstacle avoidance module

  • Inject a struct pointer to all oa function calls
  • Explicitly handle ownership of oa in the map server thread
  • All queries to oa should be properly synchronized.

Rename control panel LEDs

The control panel LED names don't correspond to their true function.
And as we're at it, we should label them also on the robot hardware.

Rework wiring

  • Power CAN bus (5V) through Master board dedicated connector
  • Get rid of Y connections over CAN bus
  • Get rid of loops in CAN bus connections
  • Fix arm pump bad connection (over CAN)

generate config.c from yaml

So it appears to me that the config.c file from master firmware has a lot of boilerplate code that can probably be autogenerated from config.yml anyways. So we should do that.

I think this can be a good beginner project for someone interested in build tools (nobody is interested in build tools?)

Move compiler defines to header file

Many configuration parameters for different subsystems are accumulating in the Makefile.
In my opinion this is a bad practice and those parameters should be independent of the build system.
I propose to move them into header files grouped by topic.

example from master-firmware:

# List all default C defines here, like -DDEBUG
DDEFS += -DUAVCAN_TOSTRING=0 \
		 -DUAVCAN_STM32_NUM_IFACES=1 \
		 -DUAVCAN_STM32_TIMER_NUMBER=2 \
		 -DUAVCAN_STM32_CHIBIOS=1 \
		 -DUAVCAN_TINY=0 \
		 -DLWIP_DEBUG=1 \
		 -DSHELL_MAX_ARGUMENTS=5 \
		 -DSHELL_CMD_THREADS_ENABLED=FALSE \
		 -DSHELL_CMD_TEST_ENABLED=FALSE

Score counting

Requires:

  • Functional driver for LCD screen
  • Display numbers on the LCD screen
  • Mounted LCD screen on the robot
  • Wired LCD screen on the robot
  • Count points in strategy and display current score asynchronously

What are {build,test}.sh ?

I see that all the individual projects are littered with {build,test}.sh files, that seem to sort-of automate the build of the project. I feel like this belongs to the developer's own automation and we should not put that kind of stuff in the repository, but I would like to hear the team's own arguments for this: what are your feelings on this guys ?

Count score by watching goap state

Score counting #99 is now live on the robot, but it would be better to do it by watching the goap state instead of increasing it in each action execution.

PID tuner

  • Motor monitor
  • PID feedback live plot
  • Parameter read/set
  • Make proper python package
  • Save params
  • Support Master board PID tuning

Make logging great again

We have a lack of logging on our robots:

  • We need to log more, use DEBUG for internal logging.
  • We need to enable SD card storage of logs again.
  • We need to be able to retrieve saved logs via ethernet (reenable the http server).

Motor board config loading

I think the config loading should be documented somewhere in this repo.
Or even better, write a python package with tools to interact with a motor board (like we have for the CAN bootloader).

How can we handle time in GOAP?

So as you all know, we had some issue to properly tell GOAP "Please do not do this action before XX seconds into the game". We tried hacking something, but it did not work somehow.

What I personally see would be to put the time constraint in the can_run method, where we would compare trajectory_get_time() > 80 for example.

Another option would be to put the time in the state, but then I am afraid that GOAP would just do stupid actions "waiting" for the time to come instead of staying idle / trying new goals.

Color sequence detection [MVP2]

MVP2 should provide this behavior:
Given: The camera (with embedded computer) is rigidly mounted on a beacon spot
When: It is turned on (power on of the whole module)
Then: It determines the color sequence and streams it regularly via a wireless connection (TBD) to the robot(s)

Robot specific parameters storage and loading

We need to choose how to store and load the configuration of different robots. Do we use config.yaml for everything and remove all the defines.
There are common parameters and ones that are specific to each robot. How do we separate those ?

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.