All Projects → paparazzi → pprzlink

paparazzi / pprzlink

Licence: other
Message and communication library for the Paparazzi UAV system

Programming Languages

python
139335 projects - #7 most used programming language
C++
36643 projects - #6 most used programming language
ocaml
1615 projects
c
50402 projects - #5 most used programming language
Makefile
30231 projects
CMake
9771 projects

Projects that are alternatives of or similar to pprzlink

ESP32
DroneBridge for ESP32. A short range wifi based telemetry link. Support for MAVLink, MSP & LTM (iNAV).
Stars: ✭ 183 (+976.47%)
Mutual labels:  telemetry, datalink
QGISFMV
QGIS Full Motion Video (FMV)
Stars: ✭ 104 (+511.76%)
Mutual labels:  telemetry
Oculess
Removes account requirements and telemetry from Oculus Quest devices
Stars: ✭ 1,551 (+9023.53%)
Mutual labels:  telemetry
angular-cli-skeleton
angular-cli skeleton to quickly start a new project with advanced features and best practices. All features are described in README.md.
Stars: ✭ 32 (+88.24%)
Mutual labels:  ivy
taar
Telemetry-Aware Addon Recommender
Stars: ✭ 23 (+35.29%)
Mutual labels:  telemetry
PerfSpect
system performance characterization tool based on linux perf
Stars: ✭ 45 (+164.71%)
Mutual labels:  telemetry
ApplicationInsights-Ruby
Microsoft Application Insights SDK for Ruby
Stars: ✭ 30 (+76.47%)
Mutual labels:  telemetry
TraceEvent
Trace events in real time sessions
Stars: ✭ 26 (+52.94%)
Mutual labels:  telemetry
doom-todo-ivy
Display all TODO and FIXME entries for a project or buffer in ivy. Extracted from doom-emacs.
Stars: ✭ 31 (+82.35%)
Mutual labels:  ivy
opentelemetry-ruby
OpenTelemetry Ruby API & SDK, and related gems
Stars: ✭ 332 (+1852.94%)
Mutual labels:  telemetry
white-vest
White Vest is a project for collecting, logging, emitting, and visualizing telemetry from a model rocket containing an inboard Raspberry Pi Zero with an Arduino receiving telemetry.
Stars: ✭ 28 (+64.71%)
Mutual labels:  telemetry
vscode-extension-telemetry
Node module to help VS Code extensions send telemetry using application insights
Stars: ✭ 89 (+423.53%)
Mutual labels:  telemetry
counsel-org-clock
Counsel (Ivy) interface for org-clock
Stars: ✭ 44 (+158.82%)
Mutual labels:  ivy
stanza
Fast and lightweight log transport and processing.
Stars: ✭ 142 (+735.29%)
Mutual labels:  telemetry
telemetry collector
build telemetry software stack for Cisco nx-os, support both telemetry dial-out and gNMI dial-in
Stars: ✭ 39 (+129.41%)
Mutual labels:  telemetry
appinsights-rs
Application Insights SDK for Rust
Stars: ✭ 29 (+70.59%)
Mutual labels:  telemetry
HPR-Rocket-Flight-Computer
A flight computer for high-powered rockets based on the Teensy platform. 4 programmable pyro outputs, Mach immune flight events, air-start & two-stage capable w/ tilt-sensing safety features, GPS & live telemetry. High-rate data logging at 1000 samples per second. 4.0in x 1.25in x 0.5in fits in a 38mm tube coupler.
Stars: ✭ 33 (+94.12%)
Mutual labels:  telemetry
ets2-dashboard-skin
Packaged application in VueJs to run on a Windows computer It allows to deport some information of the video games Eurotruck simulator and Americantruck simulator on another device (via the web browser). And thus have an increased immersion in these games.
Stars: ✭ 37 (+117.65%)
Mutual labels:  telemetry
newrelic-telemetry-sdk-java
Java library for sending telemetry data to New Relic
Stars: ✭ 34 (+100%)
Mutual labels:  telemetry
Mercury-GS
An Open Source Program that allows users to interact with a Spacecraft in a lab environment, pre-launch.
Stars: ✭ 18 (+5.88%)
Mutual labels:  telemetry

PPRZLINK

PPRZLINK is a messages toolkit (message definition, code generators, libraries) to be used with Paparazzi UAV System and compatible systems. One tool that uses PPRZLINK is the Flying Robot Commander, a web based, RESTful application for controlling multiple aircraft.

Documentation

Documentation is in the doc subdirectory and can be viewed on https://pprzlink.readthedocs.org

To build the docs locally:

sudo pip install sphinx sphinx-autobuild sphinx_rtd_theme
cd doc && make html

Libraries

PPRZLINK libraries are available for the following programming languages:

License

PPRZLINK is released under:

  • GPLv2 (or later) for the OCaml and C libraries (v1.0 and v2.0)
  • GPLv3 (or later) for the code generators
  • LGPLv3 (or later) for the Python library (v1.0 and v2.0)

See license files (LICENSE.xxxx) for details

Messages

Messages are defined in the messages.xml file and are grouped into the following message classes:

  • telemetry
  • datalink
  • ground
  • alert
  • intermcu

Please reference Paparazzi Messages Document for a more detailed overview.

Message Classes

Telemetry

Telemetry messages are sent from the aircraft to the ground and are defined in the telemetry class of the messages.xml file.

Datalink

Datalink messages are sent from the ground to the aircraft and are defined in the datalink class of the messages.xml file.

Ground

Ground messages are sent to the ground network agents (GCS, server, link, etc) and are defined in the ground class of the messages.xml file.

Alert

TBD

InterMCU

TBD

Python Library

The Python PPRZLINK ivy interface is defined in ivy.py. There is also a serial version of the interface in serial.py.

Ivy Message Call Sequence

Add library root to the search path:

# if PAPARAZZI_SRC not set, then assume the tree containing this file is a reasonable substitute
PPRZ_SRC = getenv("PAPARAZZI_SRC", path.normpath(path.join(path.dirname(path.abspath(__file__)), '~/paparazzi/')))

sys.path.append(PPRZ_SRC + "/sw/ext/pprzlink/lib/v1.0/python")

from pprzlink.ivy  import IvyMessagesInterface
from pprzlink.message   import PprzMessage
...

Create a new IvyMessagesInterface instance:

ivy_interface = IvyMessagesInterface("FlyingRobotCommander", start_ivy=False)

Subscribe to all messages:

ivy_interface.subscribe(callback_aircraft_messages)
...

Start the interface:

ivy_interface.start()
...

Send messages:

# Main Loop
ivy_interface.send(msg)
ivy_interface.send_raw_datalink(msg)
...

Stop the interface in the end:

ivy_interface.shutdown()
...

Ivy Message Construction

It's easy to construct messages to send over the ivy message bus. Here are a few example python functions for reference.

Datalink Message

def guidance(ac_id, flag, x, y, z, yaw):
    msg = PprzMessage("datalink", "GUIDED_SETPOINT_NED")
    msg['ac_id'] = ac_id
    msg['flags'] = flag
    msg['x']     = x
    msg['y']     = y
    msg['z']     = z
    msg['yaw']   = yaw

    ivy_interface.send_raw_datalink(msg)

Ground Message

def flightblock(ac_id, fb_id):
    msg = PprzMessage("ground", "JUMP_TO_BLOCK")
    msg['ac_id']    = ac_id
    msg['block_id'] = fb_id

    ivy_interface.send(msg)

Data Request Message

    def request_config(ac_id):
        def aircraft_config_callback(ac_id, msg):
            logger.info(f"Got new aircraft config {ac_id}: {msg}")
            name = msg['ac_name']
            ....
            
        ivy.send_request(
            class_name="ground",
            request_name="CONFIG",
            callback=aircraft_config_callback,
            ac_id=ac_id
        )

Subscribing to Ivy Messages

Subscribe method can be used to register a callback for all messages:

def cb(ac_id: str, msg: PprzMessage):
    # Subscribed to all messages without any filter
    pass
binding_id = ivy.subscribe(cb)

or to receive messages of a certain class:

def notify_new_aircraft(ac_id: str, msg: PprzMessage):
    assert msg.class_name == 'ground'
    assert msg.name == 'NEW_AIRCRAFT'
    
binding_id = ivy.subscribe(notify_new_aircraft, PprzMessage("ground", "NEW_AIRCRAFT"))

or you can have a custom regex to catch certain messages:

def answer_request(ac_id: str, message: PprzMessage):
    pass

binding_id = ivy.subscribe(answer_request, r"^((\S*\s*)\d+_\d+ CONFIG_REQ( .*|$))")

Please note that the regex should match the whole message as one group. It means you probably need catch all patterns in the beginning and end, also if there are parentheses within your custom pattern, you should wrap the whole pattern in parentheses. Note that the message can have trailing spaces which should be kept to properly parse the message into a PprzMessage object down the line.

subscribe method returns an id which can later be used to remove that subscription. See send_request implementation in ivy.py for a practical example.

ivy.unsubscribe(binding_id)
# or
ivy.unbind(binding_id)

If your agent needs to answer advanced request messages you can use subscribe_request_answerer method. The callback you register should return a PprzMessage which will be used as the response.

def answer_request(ac_id: int, request_msg: PprzMessage) -> PprzMessage:
    # request_msg will be of type CONFIG_REQ
    
    answer = PprzMessage("ground", "CONFIG")
    answer['ac_id'] = request_msg['ac_id']
    answer['flight_plan'] = 'file:///path/to/fligh_plan.xml'
    answer[...] = ...

    return answer 

ivy.subscribe_request_answerer(answer_request, "CONFIG")  # No `_REQ` here

C standalone Library

The C standalone library can be used when only a few messages using the PPRZ transport are expected (in comparison with the full C library where all messages are generated and both device and transport can be selected independently). This is useful when implementing a program in C in an embedded computer talking to the autopilot through a serial port. It is a header only library, so there is no file to compile.

Generation of a C standalone messages parse

Assuming we only need the GPS and ATTITUDE messages, either sending or receiving, the generation of the library is as follow:

./tools/generator/gen_messages.py --protocol 2.0 --lang C_standalone -o build/pprzlink/my_pprz_messages.h message_definitions/v1.0/messages.xml telemetry --opt ATTITUDE,GPS

The generated files will be placed in the folder build/pprzlink in this case. The folder pprzlink and the files it contains should be copied to your project directory (or any library folder part of your include paths).

Usage for sending

Sending a message is done as follows:

Include the library header

#include "pprzlink/my_pprz_messages.h"

Implement some required callbacks (definitions can be found in pprzlink/pprzlink_standalone.h): check_space, put_char, send_message (or NULL if not needed)

int check_space(uint8_t n) {
  // implement your check space function here
}

void put_char(uint8_t c) {
  // implement your put char function here
}

void send_message(void) {
  // implement your send message function here
}

Init the TX structure (definitions can be found in pprzlink/pprzlink_standalone.h):

// somewhere in your init section
struct pprzlink_device_tx dev_tx = pprzlink_device_tx_init(check_space, put_char, send_message /* or NULL */);

Send messages (replace ... with paramters, see definition in pprzlink/my_pprz_messages.h):

// in the case of GPS message
pprzlink_msg_send_GPS(&dev_tx, ...);

Usage for receiving

Include the library header

#include "pprzlink/my_pprz_messages.h"

Implement some required callbacks (definitions can be found in pprzlink/pprzlink_standalone.h): char_available, get_char, new_message as well as a buffer large enough to receive your messages (max 255 bytes):

int char_available(void) {
  // implement your char available function here
}

uint8_t get_char(void) {
  // implement your get char function here
}

uint8_t rx_buffer[255];

void new_message(uint8_t sender_id, uint8_t receiver_id, uint8_t class_id, uint8_t message_id, uint8_t *buf, void *user_data) {
  // check message/class IDs to before extracting data from the messages
  if (message_id == PPRZ_MSG_ID_GPS) {
    // get data from GPS
    int32_t east = pprzlink_get_GPS_utm_east(buf);
    int32_t north = pprzlink_get_GPS_utm_north(buf);
  }
  else if (message_id == PPRZ_MSG_ID_ATTITUDE) {
    // get data from ATTITUDE
  }
}

Init the RX structure (definitions can be found in pprzlink/pprzlink_standalone.h):

// somewhere in your init section
struct pprzlink_device_rx dev_rx = pprzlink_device_rx_init(char_available, get_char, rx_buffer, (void *)&user_data);

Where user_data is a pointer to a structure that you may want to pass at init and use in the new_message callback. If no user data are needed, just pass NULL as argument value. Parse messages by calling this function in your mainloop:

pprzlink_check_and_parse(&dev_rx, new_message);
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].