I want to enable the rangefinder in hover mode and use the barometer in normal travel. How can I enable and disable the rangefinder in the code? thanks
You need to specify it a little bit… but I think it is not possible… but please give further information from what are you intending to do.
l want to start the shooting task in althold mode, because it is better to use a rangefinder to set the height in althold mode, so I want to use a barometer when the plane is moving, and switch to a rangefinder in althold mode. can i enable or disable the rangefinder at runtime?by the way ,i use the rangefinder to fix the height upwards
you might try this:
https://ardupilot.org/copter/docs/common-auxiliary-functions.html?highlight=auxiliary
If it will be moving in Auto Mode (following pre-defined waypoints), you can simply change your coordinates frame to Relative when planning your mission, so in Auto mode it will fly by barometer height and in AltHold it will use rangefinder (as soon as you have enabled surface tracking feature by parameters, that’s what I think it is the case for you).
Thanks for your advice. I’ll try it