Skip to content

feat: add radar_N.enabled to run one node per radar - #6

Merged
DiuLaMaX merged 1 commit into
mainfrom
linwei/radar-enabled-flag
Sep 30, 2026
Merged

DiuLaMaX merged 1 commit into
mainfrom
linwei/radar-enabled-flag

Conversation

@DiuLaMaX

@DiuLaMaX DiuLaMaX commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a per-radar enabled parameter to mark radar_N entries that have no sensor behind them.

The driver maps radar_N to CAN sensor id N and stops at the first missing index,
so a config with sensors 1, 3, 6 and 7 still needs placeholder entries for 0, 2, 4 and 5.
Today those placeholders act like real radars:

  • On activation, the node sends each one a full set of default filter configs.
  • If a frame arrives with a placeholder's id, the node decodes it and fails the TF lookup on the placeholder's link_name.
  • set_filter and set_radar_configuration accept a placeholder's id and send that sensor default settings.

With radar_N.enabled: false (default true), the entry only holds its index:

  • No filter or motion frames are sent to it.
  • Its received frames are dropped.
  • set_filter and set_radar_configuration return success: false for its id.

Existing configs are unaffected, since every entry defaults to enabled.

This also lets several driver nodes share one CAN bus.
Each node enables only its own radars, so no node overwrites another's filters.
Every node serves the same absolute service names,
so a request is carried out only by the node that enables that sensor_id.

Other changes

  • The filter-config and FOV timers are now created once after the per-radar loop, instead of on every iteration.
  • can_receive_callback's range check now uses isRadarEnabled(),
    which also fixes an unsigned underflow when no radars are configured.
  • README: documents radar_N.enabled.

Example

One node, four radars on sensor ids 1, 3, 6 and 7:

radar_node:
  ros__parameters:
    can_channel: can0
    radar_0: {link_name: noop, enabled: false}
    radar_1:
      link_name: front_center_radar_link
    radar_2: {link_name: noop, enabled: false}
    radar_3:
      link_name: front_right_radar_link
    radar_4: {link_name: noop, enabled: false}
    radar_5: {link_name: noop, enabled: false}
    radar_6:
      link_name: front_left_radar_link
    radar_7:
      link_name: rear_center_radar_link

Result

Measured on the AFM with ros_rate_latency.py, one driver node, four radars.
Gaps are in seconds, latencies in milliseconds.

Before (placeholders enabled): tracks arrive sporadically at 0.2–1.0 Hz, and some topics get no data at all.

/front_center_radar_link/radar_tracks        --       --       --       --       --      0  (no data)
/front_right_radar_link/radar_tracks         --       --       --       --       --      1  (no data)
/front_left_radar_link/radar_tracks         0.8    1.180    1.180      1.3      1.4      2
/rear_center_radar_link/radar_tracks         --       --       --       --       --      1  (no data)

topic                                        hz  gap_p50  gap_max  lat_p50  lat_max  total  [s / ms]
/front_center_radar_link/radar_tracks       0.2    4.056    4.056      1.5      1.9      2
/front_right_radar_link/radar_tracks        1.0    0.998    1.770      1.2      1.2      3
/front_left_radar_link/radar_tracks         0.7    1.363    1.545      1.3      1.4      3
/rear_center_radar_link/radar_tracks        0.2    5.001    5.001      1.2      1.3      2

After (placeholders enabled: false): all four radars publish steadily at 13.6 Hz.

topic                                        hz  gap_p50  gap_max  lat_p50  lat_max  total  [s / ms]
/front_center_radar_link/radar_tracks      13.6    0.075    0.076      1.1      2.1     68
/front_right_radar_link/radar_tracks       13.6    0.075    0.077      1.2      1.9     68
/front_left_radar_link/radar_tracks        13.6    0.075    0.076      1.3      2.1     68
/rear_center_radar_link/radar_tracks       13.6    0.075    0.077      1.2      2.8     68

topic                                        hz  gap_p50  gap_max  lat_p50  lat_max  total  [s / ms]
/front_center_radar_link/radar_tracks      13.6    0.075    0.077      1.1      2.2    136
/front_right_radar_link/radar_tracks       13.6    0.075    0.077      1.2      2.1    136
/front_left_radar_link/radar_tracks        13.6    0.075    0.076      1.2      2.1    136
/rear_center_radar_link/radar_tracks       13.6    0.075    0.077      1.2      2.8    136

@DiuLaMaX
DiuLaMaX merged commit c25758b into main Sep 30, 2026
3 of 4 checks passed
@DiuLaMaX
DiuLaMaX deleted the linwei/radar-enabled-flag branch September 30, 2026 17:55
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.

2 participants