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

LD06 Proximity Sensor Integration #20138

Merged
merged 3 commits into from
Oct 4, 2023

Conversation

Adithya-Patil
Copy link
Contributor

@Adithya-Patil Adithya-Patil commented Feb 22, 2022

Creating a new Innomaker LD06 LiDAR driver for proximity sensing/obstacle avoidance. Communication protocol for sensor linked here.

Closes #17211
LDROBOT_LD06_Development manual_v1.0_en.pdf

Copy link
Member

@hendjoshsr71 hendjoshsr71 left a comment

Choose a reason for hiding this comment

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

Hello! thanks for this contribution it is a good start especailly if you are new to C++!

Have you tested this yet?
Looks like it is failing to compile on Durandal. Do you have your development environment setup to compile it?

You will need to add the new driver to the enum here

You need to call the detect() method as as it stands right now the compiler may not be pulling in any of this code.

Add the call to detect around here in AP_Proximity.cpp:

Add to the Param Description here:

// @Values: 0:None,7:LightwareSF40c,2:MAVLink,3:TeraRangerTower,4:RangeFinder,5:RPLidarA2,6:TeraRangerTowerEvo,8:LightwareSF45B,10:SITL,12:AirSimSITL,13:CygbotD1

We should also add #if AP_PROXIMITY_LD06_ENABLED so users can decide to compile it in or not.

You aren't checking the CRC packets?

There is more here to do .... but these are starts especially the compiling bit.

Closes #17211

libraries/AP_Proximity/AP_Proximity_LD06.h Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.h Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.cpp Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.cpp Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.cpp Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.cpp Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.cpp Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.h Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.cpp Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.cpp Outdated Show resolved Hide resolved
Copy link
Member

@hendjoshsr71 hendjoshsr71 left a comment

Choose a reason for hiding this comment

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

Some more review but I didn't get to the CPP yet so bug me again about it. Maybe after you've done some testing on your end.

libraries/AP_Proximity/AP_Proximity.cpp Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity.cpp Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.h Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.h Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.h Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.h Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.h Outdated Show resolved Hide resolved
Copy link
Member

@hendjoshsr71 hendjoshsr71 left a comment

Choose a reason for hiding this comment

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

Lots of stylistic nitpicks.

And some small cleanups but I don't see any glaring reason why you get the difference in output in your GCS_Send_TEXT vs MissionPLanner's GUI tool.

libraries/AP_Proximity/AP_Proximity.cpp Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.cpp Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.cpp Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.cpp Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.cpp Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.cpp Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.cpp Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.cpp Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.cpp Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.cpp Outdated Show resolved Hide resolved
@hendjoshsr71
Copy link
Member

hendjoshsr71 commented Apr 27, 2022

I've pushed two commits onto this PR to no longer use the table based approach for the CRC.

You still will need to squash up and fix your commits. But I think you are nearly there given your testing.

Added a rebase too.

@Adithya-Patil
Copy link
Contributor Author

Completed testing the LiDAR with a Pixhawk 4 controller. Videos below demonstrate the LiDAR working with Mission Planner's Proximity Sensor feature:
https://photos.app.goo.gl/GmoLTm4FoQF1soSEA
https://photos.app.goo.gl/qUvXH74AnAHz9rMi7

@hendjoshsr71
Copy link
Member

Cleaned up the commit list and fixed a few style items.

Once you retest it with changes to the crc_function we can remove the commented out code and squash things again.

@hendjoshsr71 hendjoshsr71 force-pushed the LD06_Integration branch 2 times, most recently from 2ea4995 to a9c1c04 Compare April 29, 2022 21:25
libraries/AP_Proximity/AP_Proximity_LD06.cpp Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@rishabsingh3003 rishabsingh3003 left a comment

Choose a reason for hiding this comment

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

Thanks for this @Adithya-Patil! Overall looks great. One thing that I can't immediately find in the driver is the use of PRX_YAW_CORR to correct for devices that are not connected facing forward?
An easy way to test would be to change PRX_ORIENT and PRX_YAW_CORR and see if they reflect correctly in your driver? I think we have missed this in some of our earlier drivers and needs to be addressed for them as well.

Copy link
Contributor

@tatsuy tatsuy left a comment

Choose a reason for hiding this comment

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

I tested this with LD06.
Once the log started, it stopped working.
I think this change will solve the problem.

libraries/AP_Proximity/AP_Proximity_LD06.cpp Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.cpp Outdated Show resolved Hide resolved
@hendjoshsr71
Copy link
Member

fixed up the commits by doing a soft reset and then did a git rebase master

That should get this passing autotests that were failing

@Hwurzburg Hwurzburg added the WikiNeeded needs wiki update label Jul 29, 2023
@lvale
Copy link
Member

lvale commented Aug 7, 2023

@rishabsingh3003 When can you check the logs?

@rmackay9
Copy link
Contributor

rmackay9 commented Aug 8, 2023

Not a blocker but we should add an entry to the custom build server for this new proximity sensor

@tridge
Copy link
Contributor

tridge commented Aug 8, 2023

rebase

@tridge
Copy link
Contributor

tridge commented Aug 8, 2023

@rishabsingh3003 I've given you maintainer status so you can push to PR branches

Copy link
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

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

Those defines are actually a problem and may lead to compilation failures (particularly in the test_build_options.py script

libraries/AP_Proximity/AP_Proximity_LD06.cpp Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.h Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.h Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.h Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.h Outdated Show resolved Hide resolved
libraries/AP_Proximity/AP_Proximity_LD06.h Outdated Show resolved Hide resolved
@rishabsingh3003
Copy link
Contributor

@lvale now that I have push access, I'll fix up the issues and rebase it over the weekend.

@rishabsingh3003
Copy link
Contributor

@lvale I have cleaned this PR up a little bit. Can you please check if this still works fine?

@lvale
Copy link
Member

lvale commented Sep 26, 2023

@lvale I have cleaned this PR up a little bit. Can you please check if this still works fine?

@rishabsingh3003 Sorry for the delay testing.

Everything looks fine, so I believe it is good to go

image

@tridge tridge dismissed rishabsingh3003’s stale review October 4, 2023 08:07

waiting for too long, Luis has tested this driver a lot

@peterbarker peterbarker merged commit 368f744 into ArduPilot:master Oct 4, 2023
@peterbarker
Copy link
Contributor

Merged, thanks for your patience @Adithya-Patil , @lvale

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.

Copter: Support light and small Proximity device LD06.
10 participants