... | ... | @@ -26,10 +26,10 @@ has to be entered. If it is transmitted via the CAN-bus the command: |
|
|
|
|
|
is necessary.
|
|
|
# Implementation
|
|
|
The px4 flightstack offers two different possibilities of implementing an application. That's on the one hand the implementation as a task and on the other hand the implementation as a workqueue. Drivers are normally implemented as a work queue,because it is less ressource intensiv, but it also requires an bigger integration effort. With the CAN-bus the processing of the incoming LiDAR data is simpler. That's why the application will be implemented as an task using the CAN-bus interface , which will be described in the next section.
|
|
|
The px4 flightstack offers two different possibilities of implementing an application. That's on the one hand the implementation as a task and on the other hand the implementation as a workqueue. Drivers are normally implemented as a work queue, because it is less ressource intensiv, but it also requires an bigger integration effort. With the CAN-bus the processing of the incoming LiDAR data is simpler. That's why the application will be implemented as an task using the CAN-bus interface , which will be described in the next section.
|
|
|
## CAN Interface
|
|
|
|
|
|
The procedure of the application is pictured in the flow chart below.
|
|
|
![pap_tf_can](uploads/9e7b1d2b14d98422b95ab689e0accaf1/pap_tf_can.png)
|
|
|
|
|
|
The main task is to read in the incoming LiDAR data, process it and than publish the specific px4 topic containing the measured height over ground. For this task the interface have to be initialised first, which is done in the first step. For the CAN-bus communication the required filedescriptor for the standard IO functions from the os is created. Therfore the CAN-devicefile \dev\uavcan, which is set up through the UAVCAN-driver, is the starting point. After that the baudrate gets set up through the bittiming to 1 MBaud. For the PX4 topic the distance_sensor topic gets advertised, such that the px4 standard api of publishing is accsessible. In the next step of the procedure the incoming data gets read in using the read() function and the filedescriptor. The read in datafield is a bytearray with a length of six bytes. From the datasheet of the tf03 the first two bytes are the measured distance Dist_High and Dist_Low. Those given uncertainty of the height measurement get now processed to the estimated height above ground is the next step, through calculating the mean of both distances. In the final step this estimated height gets published in the distance_sensor topic. The updaterate of this is dependet from the updaterate which the hardware provides, so there is no internal timing of this task. This procedure is implemented and integrated in the standard structure of a px4 task, so thatb it is accseibkle for the scheduler and the internal standard api of the px4 environment. After the implementation of this task, it seems that the given tf03 is not able to coomunicate via CAN-bus. Thats why another implementation using the UART-Interface is required.
|
|
|
|
|
|
## UART Interface |
|
|
\ No newline at end of file |