Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework NXP UWB driver #21124

Merged
merged 12 commits into from Jul 12, 2023
Merged

Rework NXP UWB driver #21124

merged 12 commits into from Jul 12, 2023

Conversation

NXPLoic
Copy link
Contributor

@NXPLoic NXPLoic commented Feb 14, 2023

UWB sr150 driver rework

This is a rework for the NXP UWB SR150 driver.
Enabling precision navigation task (Preclanding) based on the NXP UWB SR150 chip.

The PR includes the enablement of the UWB driver for single anchor ranging and modification of the Landing Target Estimator for precision landing.

UWB driver rework uses 2 UWB boards - 1 as a Controller (Initiator) and one as the Controllee (Anchor).
This is an improvement over the previous UWB system requiring at least 4 Anchors.
With this new system, a Angle of Arrival from three antennas on the UWB module can be used to transfer a spherical position into the Drones cartesian local position (in NED).

Graphic showing the coordinate system that is measured by the UWB system (Antennas facing up):
MicrosoftTeams-image (1)

UWB driver module changes:

  • Moved all navigation related code out of the UWB driver
  • Changed driver to take advantage of the workqueue
  • Added support for anlge of arrival measurements (AoA)
  • Updated sensor offset and added orientation parametr to represent the physical mounting
  • Removed deprecated code from code.

Landing_target_estimator module changes:

  • LTE produces position data based on SensorUwb measurements
  • Translated landing_target_estimator_params.c into module.yaml
  • Added new corrected position conversion algorithm using uwb spherical coordinates to kartesian
  • Fixed POV orientation of conversion algorithm
  • Added Offset and Orientation from UWB to the LTE position calculation.

Uorb topics:

  • UwbDistance Renamed to SensorUwb.msg to match current PX4 naming scheme for messages.
  • SensorUwb: Changed message data tot reflect measurements send by UWB system
  • SensorUwb: Added metadata to UWB Uorb message
  • SensorUwb: Added UWB Aoa figure of merit to Uorb message
  • SensorUwb: Added UWB sensor mounting configuration to Uorb message
  • UWBgrid: removed message because it is deprecated

For multiple NXP boards

  • default.px4board: Enabled uwb_sr150 driver configuration. I.e. fmuk66-e, fmurt1062-v1, and ucans32k146.

Major new features:

Autostart via workqueue
Parameters for offset and orientation propagated via Uorb
Relative position calculation via a single ground anchor
Preclanding with higher quality and easier setup

Test coverage

Screenshot showing Landing_target_pose publishing a position based on UWB:
PR LTE showing position

Screenshot of data from the UWB driver:
UWB sensor data

Screenshot of data from the landing target estimator driver:
LTE showing a landing

Flying tests 11.02.2023:
For all tests the Anchor is placed on the ground pointing north.
Parameters as listed below will be tweaked.

Test 1

LTEST_ACC_UNC = 20.0
LTEST_MEAS_UNC = 0.0005
LTEST_MODE = Moving
MPC_LAND_SPEED = 0.1 m/s
5m alt

Observations
https://logs.px4.io/plot_app?log=21814395-8676-4fff-ba6a-3fd865b73b36
Drone landed 15cm W of anchor.
Precision is higher. But wide swings left right during descend.

Test 2

LTEST_ACC_UNC = 20.0
LTEST_MEAS_UNC = 0.0005
LTEST_MODE = Moving
MPC_LAND_SPEED = 0.1 m/s
10m alt

Observations
https://logs.px4.io/plot_app?log=6bb7eee2-3fe0-47c6-82e9-cb138a58f6f3
Drone landed 20cm SW of anchor.
Precision is higher. But wide swings left right during descend and "Toilet bowl" at static search.

Test 3

LTEST_ACC_UNC = 20.0
LTEST_MEAS_UNC = 0.0005
LTEST_MODE = Stationary
MPC_LAND_SPEED = 0.1 m/s
10m alt

Observations
https://logs.px4.io/plot_app?log=bd795998-d257-4325-9ed1-056355670e37
Drone landed 30cm SE of anchor.
Precision lower than with LTEST_MODE = Moving. "Toiled bowl" at descend and very slow.

Future

  • Preclanding needs to be improved:
    • Faster to react (drone reacts quite slowly to changes)
    • More accurate (UWB system is able to achieve <10cm accuracy)
    • more reliable
  • Specific flights modes for following and preclanding
  • Follow me for drones
  • Indoor follow me for rovers/drones

Context

This is a rework of #14474

Videos and Picture will follow.

@dk7xe @NXPBrianna @dagar @bkueng @junwoo091400 @igalloway @potaito

NXPBrianna and others added 4 commits February 10, 2023 20:35
…or), one as Controllee (Anchor)

uwb_sr150: template for new UWB driver with modifications

uwb_sr150: included pr_nxp_uwb_driver & add. to new driver

uwb_sr150: updated files to make UWB demo functional. Added actuator_controls_3 again

uwb_sr150: Navigation elements localization and precision navigation removed from UWB driver to LandingTargetEstimator.

rc.sensor: Added uwb to rc.sensor list for auto-start
uwb_sr150driver: Deleted experimental uwb files
uwb_sr150: Removed parameters from uwb module.yaml

uwb_sr150: Cleaned up the code
uwb_sr150: Removed the navigation functions to LandingTargetEstimator

LTE: translated landing_target_estimator_params.c into module.yaml
LTE: added UWB params from uwb_sr150 module.yaml

UwbDistance.msg-> SensorUwb.msg: renamed UwbDistance.msg to SensorUwb.msg
SensorUwb.msg: renamed everything to correspond with the renaming of the message

uwb_sr150: Added orientation param, but need to check with Loic.
uwb_sr150: Removed gps & pos struct.

uwb_sr150: Cleaned up driver of unnecessary code.
uwb_sr150: Edited UWB board orientation param.

uwb_sr150: Readded position.
uwb_sr150: Added orientation param to module.yaml

uwb_sr150: Started making changes to UWB driver to be work queue task

uwb_sr150: Added getter for orientation param

uwb_sr150: Restructured header file to match workqueue example
uwb_sr150: Reworked to work with workqueue and remove unnecessary items

uwb_sr150: Revert "Added getter for orientation param". This reverts commit a4ccdf4.

uwb_sr150: Revert "updated files to make UWB demo functional. Added actuator_controls_3 again". This reverts commit a7db41f.

Removed Yaw and Pitch related items. TBD with Daniel

uwb_sr150: Updated copyright years & readded *buffer pointer to collectData()

rc.sensor: UWB added to wq, so not needed

Added UWB SR150 to board config

uwb_sr150: Removed no longer relevant code:
uwb_sr150: position (moved to landing_target_estimator).
uwb_sr150: uwb_pos_debug is removed completely

Added uwb_sr150 driver config to NXP boards

LTE: added new corrected position conversion algorithm from uwb spherical coordinates to kartesian
LTE: removed deprecated code

LTE: Fixed compile issues
LTE: LTE produces data upon UWB sensor_uwb publish produced data is corrupt

LTE: Fixed LTE position not bein calculated on non corrupt data

LTE: Fixed POV orientation of conversion algorithm

SensorUwb.msg: Added metadata to UWB Uorb message

SensorUwb.msg: Added UWB Aoa figure of merit to Uorb message
SensorUwb.msg: Added UWB sensor mounting configuration to Uorb message

LTE: Added Offset and Orientation from UWB

LTE: Added Offset and orientation calculation to the LTE position calculation
LTE: Changed double precision to float precision

LTE: Fixed formating
uwb_sr150: Fixed formating
Added uwb sensor plausability check
@NXPLoic NXPLoic marked this pull request as ready for review February 14, 2023 13:15
@dk7xe
Copy link
Contributor

dk7xe commented Feb 14, 2023

Picture of landing place - Test 1
Test1

Video final approach - Test 2
https://user-images.githubusercontent.com/3907200/218755546-02d30640-8bc7-41c2-9d85-a911cf75713c.mp4

Removed Deg2Rad and  used PX4 function
Changed FOV limit of AOA UWB measurements to const
@NXPLoic
Copy link
Contributor Author

NXPLoic commented Feb 17, 2023

@potaito I commited your requested changes
We are preparing some more documentation on UWB and this driver.

@dk7xe
Copy link
Contributor

dk7xe commented Feb 28, 2023

@potaito we have done another test campain for UWB based precision landing 2 weeks ago that was succesful
Log files
Test 1 - https://logs.px4.io/plot_app?log=e06b7457-364e-4fa9-8e0e-11c796a186da
Test 2a - https://logs.px4.io/plot_app?log=ff093321-7310-48a2-8f55-0d53d01aa7f5
Test 2b - https://logs.px4.io/plot_a+pp?log=00396384-de6e-4b76-8d9e-f6956b93e118
Test 2c - https://logs.px4.io/plot_app?log=1c2c8896-2f19-4761-a140-756b90f1f718
Test 2d - https://logs.px4.io/plot_app?log=a2b2b7d5-a9fa-426e-8d2f-87e960f9d2a2
Test 2e - https://logs.px4.io/plot_app?log=613c4ae2-9403-4298-87ec-56a9e5d24f35
Test 2f - https://logs.px4.io/plot_app?log=84eddd62-0857-4500-bb70-eb2181c7f2d4
Test 2g - https://logs.px4.io/plot_app?log=14ddd687-d2d3-4903-8249-9522925eeda2
Test 2h - https://logs.px4.io/plot_app?log=ec475b18-f01c-4b2d-a5e7-05df20ee6cde
Test 2i - https://logs.px4.io/plot_app?log=c5256144-f6c3-4a89-a884-07598737b741
Test 2j - https://logs.px4.io/plot_app?log=fcb76c9e-c0c7-4494-b66c-20f9dd78f888
Test 2k - https://logs.px4.io/plot_app?log=a6fcfb95-6055-4e35-b3ed-ed717bc3fb15
Test 2l - https://logs.px4.io/plot_app?log=4a188938-0882-4f19-96a0-0caf81c9d5a4
Test 2m - https://logs.px4.io/plot_app?log=63058df4-32eb-434a-b03a-4744d3b92210
Test 2n - https://logs.px4.io/plot_app?log=3a5454f5-23c5-48b0-b82f-7f5f2c51eba9
Test 2o - https://logs.px4.io/plot_app?log=b42c1812-3555-4361-9c83-2fb7dad80479
Test 3a - https://logs.px4.io/plot_app?log=6be302ab-43aa-47d3-807e-903c4b47ffe5
Test 3b - https://logs.px4.io/plot_app?log=65e95de8-7829-4878-a96f-d2a9b686f17a
Test 3c - https://logs.px4.io/plot_app?log=9b4b9bb4-1299-4b8a-abea-cdf4298f869a
Test 3d - https://logs.px4.io/plot_app?log=db9a37e0-b70a-49b3-ac08-206269faefbb
Test 3e - https://logs.px4.io/plot_app?log=4a1057e3-144e-440f-8774-e5456601dbf4
Test 3f - https://logs.px4.io/plot_app?log=65997350-586e-4fda-add6-fda3d0796567
Test 4a - https://logs.px4.io/plot_app?log=5758a62f-a052-4e56-94e6-b0a8fc7a24ba
Test 4b - https://logs.px4.io/plot_app?log=416cd35e-f393-486d-9a5f-ba03f9db1e50
Test 4c - https://logs.px4.io/plot_app?log=29b0e293-edd4-4566-9456-c185b1bc79bf
Test 4d - https://logs.px4.io/plot_app?log=bcc26045-02cc-4c9e-9b34-f982789c9e29
Test 4e - https://logs.px4.io/plot_app?log=5ddeb2b7-7343-40d0-a135-59c5322c3409
Test 4f - https://logs.px4.io/plot_app?log=86e4a058-ff35-4633-8b7b-dd473aba15a6

@dk7xe
Copy link
Contributor

dk7xe commented Apr 13, 2023

@NXPBrianna i guess this reflects UWB MW v4 orientation?

Why has the offset Y been removed (replaced) ? There could be situations where the sensor is not mounted in the centerline of the vehicle. BTW i would not use the term "drone" in the code since we are vehicle type independent.

@NXPLoic
Copy link
Contributor Author

NXPLoic commented Jun 23, 2023

I removed the Landing Target Estimator integration of the UWB driver.
This PR now only contains the UWB driver and removal of deprecated UWB interaction.
Screenshot_20230623_104417

The driver is running and receives Data from the UWB module.
@potaito @dagar

I resolved all issues and would like to request a review.
@dk7xe

@potaito
Copy link
Contributor

potaito commented Jun 24, 2023

I will take a look on Monday/Tuesday 🙂

@potaito
Copy link
Contributor

potaito commented Jun 27, 2023

@NXPLoic what's your plan for using the sensor_uwb_s message now that it was removed from Landing Target Estimator?

I don't see an issue with merging it the way it is now. Just curious what will be next, because now there is no subscriber to sensor_uwb_s and the message is also not logged.

@dk7xe
Copy link
Contributor

dk7xe commented Jun 27, 2023

Hi @potaito Allesandro, Loic will do the precision landing part soon that will use that message. We just liked to have the driver portion done before moving forward. It also gives us the ability to send the topic to ROS via dds bridge.

@potaito
Copy link
Contributor

potaito commented Jun 28, 2023

Hi @potaito Allesandro, Loic will do the precision landing part soon that will use that message. We just liked to have the driver portion done before moving forward. It also gives us the ability to send the topic to ROS via dds bridge.

Understood, thank you. Makes sense 👍

Default position is the antannaes downward facing, UWB board parallel with body frame.
type: enum
values:
0: ROTATION_NONE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bresch is there a way to re-use the rotation value definitions that already exist for other sensors?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we get an answer here?

@NXPLoic
Copy link
Contributor Author

NXPLoic commented Jul 5, 2023

Removing the changes freed up some space (Atleast from the px4_fmu-v5 build)
image
image
181 bytes vs 693 bytes

The failing checks from this commit are also present on main.

@potaito

@dk7xe
Copy link
Contributor

dk7xe commented Jul 11, 2023

@dagar @potaito @mrpollo i'd like to bring this to the developer call this week since we are stuck it seems.
SW was extensively tested. Even on AEPX4. See https://www.linkedin.com/posts/nxp-semiconductors_drones-uwb-drones-activity-7081622429617254400-FhKv/?utm_source=share&utm_medium=member_desktop

@potaito
Copy link
Contributor

potaito commented Jul 11, 2023

Apologies, I'm on vacation right now. But last I checked the PR looked good to me.

@mrpollo
Copy link
Contributor

mrpollo commented Jul 11, 2023

We can discuss on this weeks Q&A if someone from your team can join @dk7xe

@DronecodeBot
Copy link

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-community-q-a-july-12-2023/33086/5

@dagar dagar merged commit f8c9be0 into PX4:main Jul 12, 2023
81 of 85 checks passed
@mrpollo
Copy link
Contributor

mrpollo commented Jul 12, 2023

Thanks for joining the call @dk7xe, glad to see this merged

dagar pushed a commit that referenced this pull request Jul 12, 2023
* UWB driver rework that uses 2 UWB MKBoards - 1 as Controller (Initiator), one as Controllee (Anchor)

Co-authored-by: NXPBrianna <108274268+NXPBrianna@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants