GSoC 2018: UAVCAN over SITL


What’s UAVCAN, you ask? UAVCAN is a message-based protocol for components which brings greater reliability through redundancy, is quite lightweight and allows for transmission of large data structures efficiently. ArduPilot doesn’t currently simulate UAVCAN in SITL, which would be really useful for developers looking to test new features.

The first part of my project for GSoC is adding mag and gps sensor simulation over UAVCAN in SITL. The PR has already been created and is located here.

The new functionality is enabled by selecting the sitlcan board type by typing ./waf configure --board sitlcan in the root directory. To use UAVCAN, you need to enable the interface. I have included a script to enable vcan0 (thank you @Pavel_Kirienko!), which is found in Tools/scripts/setup_vcan.sh. Running the script creates the vcan0 interface which is then utilized by the new argument in sim_vehicle.py that I have added.

Now you can specify which UAVCAN interface you connect to by adding the --uavcan <interface> argument when launching. If you have used the script I included, you would type sim_vehicle.py --uavcan vcan0.

Below is what the console looks like upon launch with UAVCAN newly enabled. As you can see, on the surface there are some minor differences in output, but under the hood, mag and gps is happening over UAVCAN.

Most of my work is in libraries/AP_HAL_SITL. Instead of feeding the gps data directly to SITL, SITL now creates a Fix packet and a MagneticFieldStrength2. They are sent over vcan0 by default, but can (pun intended) be sent over any other interface. They are received by the corresponding sensor nodes, processed and then passed to SITL front-end.

Here is a screenshot of the new feature in action!

I have also included a video that demonstrates this new feature in action. Looking forward to having this feature tested and hearing thoughts!

Thank you to my mentor @siddharth for the continued help and support as well as @khancyr, @peterbarker, @MagicRuB, @Pavel_Kirienko and everyone else that helped me figure out errors I was struggling with. I’m looking forward to the next part of my project which is writing a sensor module that will convert traditional sensors into UAVCAN-enabled sensors.

3 Likes

Hi Dimitri, sounds good! Small formatting thing for this blog, if you have a chance could you put a picture or blog right at the top? It makes it more attractive especially when viewed from the main ardupilot.org page. thanks and great to have you onboard this summer!

@rmackay9 Done, thanks for the help!

@dima very nice work, any recent progress on this to report?

@tridge, currently working with Sid on the OMD framework to get a Serial to UAVCAN bridge completed. I’ve figured out basic SerialDriver stuff (receiving and sending over UART), now getting the UAVCAN basics done right now.

This is awesome! Great job @dima