ardupilot icon indicating copy to clipboard operation
ardupilot copied to clipboard

AP_DDS: Support compile-time configurable rates for each publisher

Open Ryanf55 opened this issue 1 year ago • 1 comments

Instead of hard-coded rates, allow devs to set the rates at compile time for their specific application. Rates are left the same as before, so this is reverse compatible.

Ryanf55 avatar Oct 19 '24 16:10 Ryanf55

FYI @tizianofiorenzani I thought you might like this.

Ryanf55 avatar Oct 19 '24 16:10 Ryanf55

@Ryanf55 Looks ok - backwards compatible.

Is the intention for the override to be set in a custom hdef.dat, or on the ./waf build line? Perhaps add an example usage to the README?

Either will work. I have a wiki I'm working on for compile time configuration and will add specifics there.

Ryanf55 avatar Oct 21 '24 23:10 Ryanf55

Here's my favorite way:

Add a HWDEF file in ardu_ws/src/ardupilot/dds_custom_rates.dat with contents:

AP_DDS_NAVSATFIX_PUB_ENABLED 0

Build

colcon build --packages-select ardupilot_sitl --cmake-args -DARDUPILOT_WAF_CONFIGURE_ARGS="--extra-hwdef=dds_custom_rates.dat" --event-handlers=console_direct+

Launch

source install/setup.bash
ros2 launch ardupilot_sitl sitl_dds_udp.launch.py

I also tried sim_vehicle.py

./Tools/autotest/sim_vehicle.py -v ArduPlane  --console --enable-dds --waf-configure-arg="--extra-hwdef=dds_custom_rates.dat"

Sadly, none of these seem to affect the behavior. After talking to sid, he shared that the extra-hwdef is not used for SITL.

The way you can change any define (for SITL) when config is like so:

./waf configure --board sitl --define="AP_DDS_DELAY_GPS_GLOBAL_ORIGIN_TOPIC_MS=5000" --enable-dds

Or with sim_vehicle.py

./Tools/autotest/sim_vehicle.py --configure-define="AP_DDS_DELAY_GPS_GLOBAL_ORIGIN_TOPIC_MS=5000" --enable--dds

Or with colcon

colcon build --packages-select ardupilot_sitl --cmake-args -DARDUPILOT_WAF_CONFIGURE_ARGS="--define=AP_DDS_DELAY_GPS_GLOBAL_ORIGIN_TOPIC_MS=5000" --event-handlers=console_direct+

Ryanf55 avatar Oct 24 '24 01:10 Ryanf55

WIKI is here: https://ardupilot.org/dev/docs/ros2-interfaces.html#configuring-interfaces-at-compile-time

Ryanf55 avatar Dec 15 '24 02:12 Ryanf55