Skip to content

About

ArduPilot Cyphal/CAN LUA Driver

Topics

Resources

Stars

3 stars

Watchers

2 watching

Forks

Repository files navigation

linter tests coverage

ArduPilot Cyphal/CAN LUA Driver

The driver implements Cyphal ESC service support for up to 8 ESC like Myxa, Mini node and kotleta20.

It publishes:

It subscribes on:

The driver introduces the following ArduPilot parameters:

CYP_ENABLE 1 1 means Cyphal is enabled, 0 means disabled
Default: Enabled
CYP_NODE_ID 1-127 Node identifier in Cyphal-network. Usually, 127 is reserved for debugging tools and 1 is used for an autopilot.
Default: 1
CYP_TESTS 0 If set to 1, the driver analysis his own performance and enables extra verbosity to GCS
Default: Disabled
CYP_RD 1-8191 Readiness port id. Enabled if less then 8191, otherwise disabled.
Default: 65535 (disabled).
CYP_SP 1-8191 Setpoint port id for ESCs. Enabled if less then 8191, otherwise disabled.
Default: 65535 (disabled).
CYP_FB 1-8191 ESC Feedback array of port id. Enabled if less then 8191, otherwise disabled. When enabled, it occupies 8 consecutive port identifiers. For example, if it is 3000, it will occupy [3000, 3007] identifiers.
Default: 65535 (disabled).

Limitation

The driver does not provide support for the following features:

1. Step 1. Upload ArduPilot firmware

Any modern flight controller and ArduPilot firmware with scripting support should be suitable.

Tested on Pixhawk6C, CuavV6X and CubeOrange with Copter and ArduPlane firmware v4.4.4 and v4.4.7.

Option 1. Upload the latest stable fimware with QGroundControl or MissionPlanner.

QGroundControl MissionPlanner
drawing drawing

Option 2. Build and upload firmware manually from source code.

./waf list_boards
./waf configure --board CubeOrange # Pixhawk6C, Pixhawk6X
./waf copter
./waf --targets bin/arducopter --upload

Step 2. Load Cyphal.lua to microSD card

This driver should be loaded by placing the lua script in the APM/scripts directory on the microSD card.

Opion 1. Upload Cyphal.lua script with a helper python script

pip install -r requirements.txt
./upload.py -c /dev/ttyACM0 # use a path to the flight controler

Option 2. Upload the script with card reader or using MissionPlanner

Copy directly Using MAVFtp
drawing drawing

Step 3. Configure parameters

The following parameters should be set to start the script and configure the CAN driver:

SCR_ENABLE 1 - means scripting is enabled, 0 means disabled
CAN_D1_PROTOCOL 10 - means scripting
CAN_P1_DRIVER First driver
CAN_P1_BITRATE 1000000 - Default bitrate for most of the applications

Then reboot the flight controller and Cyphal parameters should appear. If the parameters don't appear, try Refresh button in QGC or restart the GCS. You need to configure these:

CYP_SP Enable publishing sp.Vector. Choose any value withing [1, 7167]. For example, 2000.
CYP_RD Enable publishing Readiness. Choose any value withing [1, 7167]. For example, 2001.
CYP_FB Enable subscribing on a group of CompactFeedbacks. Choose any value withing [1, 7167]. For example, 3000.

Then reboot the flight controller.

Step 4. Try with yakut

Configure the yakut-related environment variables, connect autopilot and CAN-sniffer together.

drawing

If you run y mon, you should get:

drawing

Here, we have 2 nodes: autopilot with node_id=1 (it is configured in CYP_NODE_ID) and yakut with node_id=127. The autopilot publishes setpoint with port_id=2000 (CYP_SP) with ~234 Hz and readiness with port_id=2001 (CYP_RD) with ~10 Hz.

Since the node doesn't support anything except uavcan.node.Heartbeat, it doesn't have a name and registers are not avaliable via Cyphal/CAN interface.

Additionally, you can subscribes to the setpoint and readiness topics:

y sub 2001:reg.udral.service.common.Readiness
y sub 2000:reg.udral.service.actuator.common.sp.Vector8

Step 5. Try with emulated ESC

./emulate_zubax_myxa_feedback.py

KNOWN ISSUES

1. Insufficent memory loading

Try to disable some feature as it is recommended on the ardupilot forum.

For example, LOG_FILE_BUFSIZE = 8 can help.

2. Why Cyphal paramters are float?

Docs says all scripting defined parameters are of type FLOAT, ie floating point numbers.

About

ArduPilot Cyphal/CAN LUA Driver

Topics

Resources

Stars

3 stars

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages