How to add new CAN sensor in range finder

I have a millimeter radar, made a drive program under ap_rangefinder in libraries. when I try to add Here3 CAN GPS, it does not work. my driver rngfnd_type is not 24 (UAVCAN), defined a new one.
If has to use 24, how to add my millimeter driver?

Good day, can you provide more info about the sensor type you want add

typically how to integrate a CAN driver device into range finder. looks APM only supports UAVCAN now.
This is special millimeter radar from China,
WeChat Image_20210706204323
we want to add millimeter radar as CAN protocol. We made a parse program. It works only by its driver when I put it under ap_rangefinder folder.
But it conflict UAVCAN. if turn on can_p2_driver = 2, the machine can’t start up.
We found ap_rangefinder_usd1_can.cpp, looks it useful for CAN, but it is not finished.

Any advise, very appreciated.

ardupilot can support many rangefinders… better you ask to the developera to add the code for the sensor you need

it does not support CAN sensor, it support part of UAVCAN sensor only.
So we have to make driver file and want to integrate to range finder.

If you can post a link to your branch I can have a quick look.

Looks ardupilot/AP_RangeFinder_USD1_CAN.cpp can be used for, but it needs initial in ap_board_can

My firmware is based on Rover 4.0 rc2 , a older version, it may not support Hex here3 Can GPS.
Not sure.

I think the first thing I would do would be to rebase on master, we have AP_CANManager there. That will make it all much more straight forward.

You can then make a new child of AP_CANSensor for this new protocol, just as in this PR,

Of course in your case you don’t need all the scripting stuff, but the CAN side should be the same.

Very appreciated @iampete.
I will do it.
I learned what is different UAVCAN and CAN, UAVCAN uses 29 bit id that is different than CAN standard 11bit id.
In APM most support UACVAN.

@iampete The merged code link is in here

You seem to have lost your code changes in that rebase. See: