Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add per board/target dds_topics.yaml configuration for uXRCE #23724

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AlexisTM
Copy link
Contributor

@AlexisTM AlexisTM commented Sep 25, 2024

Solved Problem

  • The uXRCE configuration is buried deep within the code.
  • Changing the uXRCE configuration board/target changes it for every single board.

Solution

  • Keep the default configuration in the module
  • Add a per target dds_config.yaml file

The selection goes as, for example make px4_fmu-v6x_rover

  • Use the target file (boards/px4/fmu-v6x/rover_dds_topics.yaml)
  • If not available, use the default target board file (boards/px4/fmu-v6x/default_dds_topics.yaml)
  • If not available, use the module file (src/modules/uxrce_dds_client/dds_topics.yaml)

Changelog Entry

For release notes:

Feature New per board/target configuration file for uXRCE 
Use: `boards/{vendor}/{board}/{target}_dds_topics.yaml`

@dagar
Copy link
Member

dagar commented Sep 25, 2024

I'm certainly in favor of having customization mechanisms (for custom projects, etc), but at the moment I'm not a fan of it differing just for v6x like this.

I think what we really need here is runtime configurability.

@AlexisTM
Copy link
Contributor Author

In this case, the v6x variant is only there as an example. It doesn't have to be within the PR at all.

Runtime configuration would mean we would need to build & assign a topic to all uOrb topics. That would be close to 230 messages, each to 1+ topics.

How would you see runtime configurability?

@dagar
Copy link
Member

dagar commented Sep 25, 2024

In this case, the v6x variant is only there as an example. It doesn't have to be within the PR at all.

Thanks, I just want to be careful to keep things as consistent as possible between targets and avoid future surprises when those files inevitably diverge.

Runtime configuration would mean we would need to build & assign a topic to all uOrb topics. That would be close to 230 messages, each to 1+ topics.

Yes that's one issue, we likely need both build time and runtime configurability (for the included subset that's actually in the build).

One possible baby step is to start with a few presets (like mavlink modes) so at least we can get past trying to please everyone with radically different requirements.

@dagar
Copy link
Member

dagar commented Sep 25, 2024

Another idea that just occurred to me regarding overriding the built in dds_topics.yaml would be to allow specifying that file in kconfig. Then the default would simply be src/modules/uxrce_dds_client/dds_topics.yaml.

For example here's how a board can set a custom mavlink dialect.

menuconfig MAVLINK_DIALECT

add_custom_command(
OUTPUT ${MAVLINK_LIBRARY_DIR}/${CONFIG_MAVLINK_DIALECT}/${CONFIG_MAVLINK_DIALECT}.h
COMMAND
${PYTHON_EXECUTABLE} ${MAVLINK_GIT_DIR}/pymavlink/tools/mavgen.py
--lang C --wire-protocol 2.0
--output ${MAVLINK_LIBRARY_DIR}
${MAVLINK_GIT_DIR}/message_definitions/v1.0/${CONFIG_MAVLINK_DIALECT}.xml > ${CMAKE_CURRENT_BINARY_DIR}/mavgen_${CONFIG_MAVLINK_DIALECT}.log
DEPENDS
git_mavlink_v2
${MAVLINK_GIT_DIR}/pymavlink/tools/mavgen.py
${MAVLINK_GIT_DIR}/message_definitions/v1.0/${CONFIG_MAVLINK_DIALECT}.xml
${BOARD_DEFCONFIG}
# generate after uAvionix
mavlink_c_generate_uavionix
${MAVLINK_LIBRARY_DIR}/${MAVLINK_DIALECT_UAVIONIX}/${MAVLINK_DIALECT_UAVIONIX}.h
COMMENT "Generating Mavlink ${CONFIG_MAVLINK_DIALECT}: ${MAVLINK_GIT_DIR_RELATIVE}/message_definitions/v1.0/${CONFIG_MAVLINK_DIALECT}.xml"
)
add_custom_target(mavlink_c_generate DEPENDS ${MAVLINK_LIBRARY_DIR}/${CONFIG_MAVLINK_DIALECT}/${CONFIG_MAVLINK_DIALECT}.h)

@PetervdPerk-NXP
Copy link
Member

In this case, the v6x variant is only there as an example. It doesn't have to be within the PR at all.
Runtime configuration would mean we would need to build & assign a topic to all uOrb topics. That would be close to 230 messages, each to 1+ topics.
How would you see runtime configurability?

You could take a look on how it's done for Zenoh, there it's both compile-time (generating serializers and datatypes) and runtime mapping datatypes/topics to zenoh (ros2) topic.s

@AlexisTM
Copy link
Contributor Author

Or Mavlink's way: Configure the streams according to different default configurations.

I am a bit worried on the amount of work the runtime mapping will take, in comparison to 7 lines.

@dagar
Copy link
Member

dagar commented Sep 26, 2024

Or Mavlink's way: Configure the streams according to different default configurations.

I am a bit worried on the amount of work the runtime mapping will take, in comparison to 7 lines.

It's not one extreme or the other, first we can add this simple build time override mechanism immediately if it's actually helpful. I just don't want to carry an fmu-v6x difference that will likely diverge over time.

I'm suggesting the runtime configurability because there are a few common cases that cover the vast majority. Some people/projects will want to fully customize data flow in each direction (custom dds_topics.yaml), but most won't want to or need to with a few presets.

@AlexisTM AlexisTM force-pushed the board_specific_dds_topics branch from 8e3801f to d100827 Compare September 30, 2024 07:05
@AlexisTM
Copy link
Contributor Author

Indeed. I removed the example, as it is not required.

@mrpollo mrpollo requested a review from dagar September 30, 2024 14:16
@AlexisTM AlexisTM force-pushed the board_specific_dds_topics branch from c71b670 to 7f24d53 Compare October 24, 2024 11:38
@AlexisTM AlexisTM force-pushed the board_specific_dds_topics branch from 7f24d53 to ba12460 Compare October 29, 2024 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants