Vertiq-PX4 Integration Implementation#22892
Conversation
…a message every second
… strategy used by dshot, only with both reading and writing enabled. testing was done with a pixhawk 6c.
…mulator, and sends it right back
…vel communincations for the IQUART protocol ran auto-formatting on new/changed vertiq files. I also renamed functions in the vertiq_serial_interface to be more descriptive. renamed set_baudrate function to configure_serial_peripheral to be more clear
…andling so that we can parse out IQUART data packets
removed debugging statements
…on currently sends out velocity commands through the propeller motor control client, and reads the velocity through the brushless drive client. also, this begins the process of making vertiq_io a full output module with a mixer involved
…e toggle that determines whether to spin the motor or coast cleanup. removed px4_info statements to make sure our thread can run at full speed
…ry mask. added hard coded output
…es not have a concept of timeout yet.
…und control station
added comments
…ntroller is not armed
…or control client, and switched its id to be broadcast.
…ocedure that they would like
…whenever px4 arms or to allow the motors use their own arming method
…re logging to esc telemetry
…of adding all of the files here. fixed formatting in vertiq_io.hpp: update cmake to create and use a library of our submodule
cleanup unnecessary vars
…an process of bringing in other clients
…dule value. can also set and save parameters changed on px4
functionize all intialization and set saves
added trigger to let you re-read motor values added comment update parameter descriptions remove unused enable parameter. removed all references to the system control client delete random i variable that didn't need to exist added comments to vertiq_telemetry_manager.hpp added some comments to telemetry manager cpp added comment docstrings to client manager hpp added comments to client manager cpp
| @@ -0,0 +1,125 @@ | |||
| /**************************************************************************** | |||
| * | |||
| * Copyright (c) 2012-2024 PX4 Development Team. All rights reserved. | |||
There was a problem hiding this comment.
| * Copyright (c) 2012-2024 PX4 Development Team. All rights reserved. | |
| * Copyright (c) 2024 PX4 Development Team. All rights reserved. |
| @@ -0,0 +1,202 @@ | |||
| /**************************************************************************** | |||
| * | |||
| * Copyright (c) 2012-2024 PX4 Development Team. All rights reserved. | |||
There was a problem hiding this comment.
| * Copyright (c) 2012-2024 PX4 Development Team. All rights reserved. | |
| * Copyright (c) 2024 PX4 Development Team. All rights reserved. |
| @@ -0,0 +1,152 @@ | |||
| /**************************************************************************** | |||
| * | |||
| * Copyright (c) 2012-2024 PX4 Development Team. All rights reserved. | |||
There was a problem hiding this comment.
| * Copyright (c) 2012-2024 PX4 Development Team. All rights reserved. | |
| * Copyright (c) 2024 PX4 Development Team. All rights reserved. |
| url = https://gitlab.com/voxl-public/voxl-sdk/core-libs/libfc-sensor-api.git | ||
| [submodule "src/drivers/actuators/vertiq_io/iq-module-communication-cpp"] | ||
| path = src/drivers/actuators/vertiq_io/iq-module-communication-cpp | ||
| url = https://github.com/iq-motion-control/iq-module-communication-cpp.git |
| url = https://gitlab.com/voxl-public/voxl-sdk/core-libs/libfc-sensor-api.git | ||
| [submodule "src/drivers/actuators/vertiq_io/iq-module-communication-cpp"] | ||
| path = src/drivers/actuators/vertiq_io/iq-module-communication-cpp | ||
| url = https://github.com/iq-motion-control/iq-module-communication-cpp.git |
There was a problem hiding this comment.
| url = https://github.com/iq-motion-control/iq-module-communication-cpp.git | |
| url = https://github.com/PX4/iq-module-communication-cpp.git | |
| branch = master |
| max: 16 | ||
| reboot_required: true | ||
| default: 0 | ||
| DISARM_TRIGGER: |
There was a problem hiding this comment.
parameter naming too general, add prefix? VTQ?
|
This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there: |
…pyrights updates for serial reliability, update all copyright dates, update ve…
Rebasing branch 9 18 24
|
This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there: |
|
This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there: |
| @@ -0,0 +1,289 @@ | |||
| module_name: Vertiq IO | |||
| serial_config: | |||
| - command: vertiq_io iquart_port ${SERIAL_DEV} | |||
There was a problem hiding this comment.
serial_config command example:
There was a problem hiding this comment.
Then delete what you've added to rcS.
| zenoh start | ||
| fi | ||
|
|
||
| #Check if the Vertiq serial driver has somewhere to go |
There was a problem hiding this comment.
| #Check if the Vertiq serial driver has somewhere to go |
| fi | ||
|
|
||
| #Check if the Vertiq serial driver has somewhere to go | ||
| if param greater -s VERTIQ_IO_CFG 0 |
There was a problem hiding this comment.
| if param greater -s VERTIQ_IO_CFG 0 |
…ake use of the serial module yaml attributes
Feature/update serial init
Rebase/19 09 2024
| int _uart_fd{-1}; | ||
| char _port_in_use[20] {}; | ||
|
|
||
| #if ! defined(__PX4_QURT) |
There was a problem hiding this comment.
I would update this to Serial next and remove the QURT defines. It can happen in a followup.
High Level About this Pull Request
As previously discussed with @dagar, this pull request seeks to further couple the relationship between the PX4 flight controller and Vertiq modules. At its core, this PR introduces the IQUART serial protocol into PX4, and in doing so provides the flight controller with the ability to control and configure connected Vertiq modules
IQUART and its Clients
The IQUART serial protocol is built around its ability to communicate with a series of Clients and Entries available on Vertiq modules. All IQUART messages specify a target module ID, type ID, and type sub-ID. Type IDs refer to unique identification values given to each different IQUART client. Sub-IDs refer to specific entries within the client. For example, the Serial Interface Client (type ID 16) provides one entry with sub-ID 0.
A key portion of this PR is the inclusion of Vertiq’s C++ library as a git submodule. The library provides a C++ representation of all possible Veritq clients as well as functions for packaging proper IQUART messages.
What We’ve Added to PX4
Basic User Interface
The following examples are performed using a Pixhawk 6c using the Generic Quadcopter airframe. These serve to help in understanding the structure of the backend Vertiq support.
Boardconfig Options
Provides access to basic Vertiq module configuration through PX4 parameters. This configuration alone is not enough for flight through the IQUART protocol, but could be helpful in configuration where other protocols, such as DroneCAN, are being used to send throttle commands.
Provides access to parameters specific to the IQUART Flight Controller Interface. Enabling this configuration allows users to control a vehicle and receive telemetry from Vertiq modules through the serial port configured to vertiq_io.
Provides access to specialized parameters available only for “pulsing modules.” These are modules equipped with specialized Vertiq firmware and our Vertiq UP12 propeller.
Configuration with QGroundControl
At the moment, the easiest way for users to interact with and configure our modules is through Vertiq’s IQ Control Center software. As you can imagine, having to unplug serial connections from PX4 and reconnect them to the Control Center is a laborious process. While users could add an extra serial connection to use serial passthrough, this is not always possible. Therefore, by providing module configuration functionality directly to the flight controller, we make our users’ lives much easier.
After selecting a serial port

When the matching baud rate is set, we see the module with the matching Module ID to TARGET_MODULE_ID’s parameters appear. With this configuration, those parameters are MAX_VELOCITY, MAX_VOLTS, CONTROL_MODE, THROTTLE_CVI, VERTIQ_FC_DIR, and VERTIQ_MOTOR_DIR.
The parameters that change based on the value of TARGET_MODULE_ID are those managed by the Vertiq Configuration Handler class.
Target Module ID 0

Target Module ID 1

I did not change any values besides the TARGET_MODULE_ID, and you can see that the other Vertiq parameters were updated with values gotten from the module with ID 1.
Code Structure
Class Descriptions
Vertiq IO
Vertiq Serial Interface
Vertiq Client Manager
Vertiq Configuration Handler
EntryWrappers are used to link together a PX4 parameter and a Vertiq Client’s Entry, and are covered in more detail later
Vertiq Telemetry Manager
About EntryWrapper Objects
As mentioned above, an EntryWrapper is an object meant to connect a PX4 parameter with a Vertiq Client Entry. The goal is to ensure that when an EntryWrapper’s PX4 parameter changes, that the same change is reflected on the connected motor with the module ID TARGET_MODULE_ID.
The process for updating EntryWrappers is described by the following diagrams. The top describes what happens at a higher level when any Vertiq parameter is changed, and the bottom describes the decisions made by the EntryWrapper itself during its update.
High Level

Entry Wrapper

Parameters
Different PX4 parameters become available depending on the build configuration set at the kconfig level. Any configuration listed also includes all parameters available in the configuration above it.
Vertiq IO Enabled
The serial port mapped to our module
The baud rate to use on the serial port we open and manage
This is the module ID of the module that you would like to communicate with at the parameter level. All clients in the Vertiq Configuration Handler will be deleted and recreated with this module ID in their reinitialization
A boolean parameter that allows you to refresh responses from the module with module ID TARGET_MODULE_ID
This parameter is part of an EntryWrapper. This means that it acts as both a PX4 parameter and a Vertiq Client Entry. Specifically, this parameter interacts with the mode entry in the ESC Propeller Input Parser Client
This parameter is part of an EntryWrapper that interacts with the velocity_max entry in the ESC Propeller Input Parser Client
This parameter is part of an EntryWrapper that interacts with the volts_max entry in the ESC Propeller Input Parser Client
This parameter is part of an EntryWrapper that interacts with the sign entry in the ESC Propeller Input Parser Client
This parameter is part of an EntryWrapper that interacts with the flip_negative entry in the ESC Propeller Input Parser Client
IFCI Configuration Enabled
The number of Control Values (discussed more here) that will be transmitted during each updateOutputs call
This specifies the behavior to be used when the mixer disarms. The choices are enumerated as the following
Specifies that the output control values should match the value set as the mixer’s disarmed value for each ESC channel
Sends an explicit disarm command to all connected motors
Sends an explicit coast command to all connected motors. When coasted, Vertiq ESCs stop sending control voltages allowing the motor to spin freely
Sends an explicit control velocity command to all connected motors
This specifies the behavior to be used when the mixer arms. The choices are enumerated as the following
Sends an explicit arm command to all connected motors
Uses each of the connected modules’ unique arming configurations to decide its own behavior based on the output throttle
This parameter is part of an EntryWrapper that interacts with the throttle_cvi entry in the IQUART Flight Controller Interface Client
This is a 32 bit bitmask with values 0-31 that allows users to easily select the module IDs from which they would like to receive telemetry. Combines with TELEM_IDS_2 to create a 64-bit bitmask of all possible Vertiq module IDs
This is a 32 bit bitmask with values 32-62 that allows users to easily select the module IDs from which they would like to receive telemetry. Combines with TELEM_IDS_1 to create a 64-bit bitmask of all possible Vertiq module IDs
Pulsing Configuration Enabled
This parameter is part of an EntryWrapper that interacts with the pulsing_voltage_mode entry in the Pulsing Rectangular Input Parser Client
This parameter is part of an EntryWrapper that interacts with the pulsing_voltage_limit entry in the Pulsing Rectangular Input Parser Client
This parameter is part of an EntryWrapper that interacts with the x_cvi entry in the IQUART Flight Controller Interface Client
This parameter is part of an EntryWrapper that interacts with the y_cvi entry in the IQUART Flight Controller Interface Client
This parameter is part of an EntryWrapper that interacts with the zero_angle entry in the Voltage Superposition Client
This parameter is part of an EntryWrapper that interacts with the velocity_cutoff entry in the Voltage Superposition Client
This parameter is part of an EntryWrapper that interacts with the propeller_torque_offset_angle entry in the Voltage Superposition Client
Telemetry
With IFCI enabled, telemetry is requested from the Module IDs specified in the TELEM_IDS_1/2 in a round robin fashion. The data returned are described in the following struct:

Using the response, we fill in the esc_status publication’s esc_rpm, esc_voltage, esc_current, esc_power, and esc_temperature. The esc_armed_flags and esc_online_flags are set high for each ESC after the first successfully received telemetry response from each expected motor.
Non-Pulsing Flight Configuration Example with a Pixhawk 6c
In this example, our connected modules are set to a 921600 baud with module IDs 0, 26, 42, and 62 (configured using the IQ Control Center software)
In this case, we have 4 modules connected, each of which supports only the Throttle Control Value. In order for each of the modules to receive their own unique throttle command, we must send 4 Control Values (CVs)
Attached to this PR as well as below are a video of a hover flight as well as the log from it using the configuration described here.
vertiq_io_flight_sample.MOV
Link to Log