Using lidar SF1xx in rapberry pi + navio to altitude stimation

Hellow,

I’m using a raspberry pi + navio with px4 v1.6.5 and I want to add a lidar SF11 sensor to improve the altitude stimation. I’m really new in px4 and I’m not sure how can I add this sensor to px4 compilation. I mean, if it was possible use the same code of nuttx, how can I add it to the altitud stimator and the px4 compilation.

You can find the sf1xx driver under src/drivers (https://github.com/PX4/Firmware/blob/master/src/drivers/sf1xx/sf1xx.cpp). The modules built per configuration (autopilot board basically) are under cmake/configs. For example here’s the config for px4fmu-v3_default (a pixhawk). https://github.com/PX4/Firmware/blob/master/cmake/configs/nuttx_px4fmu-v3_default.cmake#L56

Here’s the config for the raspberrypi (navio2). https://github.com/PX4/Firmware/blob/master/cmake/configs/posix_rpi_common.cmake

So add drivers/sf1xx to cmake/configs/posix_rpi_common.cmake, then work through the minor complication problems. NuttX headers will need to be removed or replaced with px4 platform versions.

Any usage of ioctl, open, close, etc dealing with the /dev/sf1xx device within px4 needs to be replaced with the px4 version (px4_ioctl, px4_open, px4_close, etc). Access a real physical serial port should still use ::open, ::close, ::read though.

Any helper functions that exit need to be changed. On NuttX each module is a task (like a process). In Linux each module is actually a thread within a single process, so exit will actually exit the entire px4 process.

Does that make sense?