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

AP_Proximity: Add support for MR72 CAN #25801

Merged
merged 3 commits into from
Feb 5, 2024

Conversation

rishabsingh3003
Copy link
Contributor

This adds support for the CAN variant of MR72.
http://en.nanoradar.cn/Article/detail/id/488.html

@tridge tridge added NeedsTesting WikiNeeded needs wiki update and removed DevCallEU labels Dec 27, 2023
@rishabsingh3003
Copy link
Contributor Author

This has now been well tested by me and NanoRadar

@@ -8,7 +8,7 @@ const AP_Param::GroupInfo AP_Proximity_Params::var_info[] = {
// @Param: _TYPE
// @DisplayName: Proximity type
// @Description: What type of proximity sensor is connected
// @Values: 0:None,7:LightwareSF40c,2:MAVLink,3:TeraRangerTower,4:RangeFinder,5:RPLidarA2,6:TeraRangerTowerEvo,8:LightwareSF45B,10:SITL,12:AirSimSITL,13:CygbotD1, 14:DroneCAN, 15:Scripting, 16:LD06
// @Values: 0:None,7:LightwareSF40c,2:MAVLink,3:TeraRangerTower,4:RangeFinder,5:RPLidarA2,6:TeraRangerTowerEvo,8:LightwareSF45B,10:SITL,12:AirSimSITL,13:CygbotD1, 14:DroneCAN, 15:Scripting, 16:LD06, 17: MR72_CAN
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: no need for the space after the ":". not a blocker, sorry to be annoying, just my OCD.


Vector2f obstacle_fr;
// This parsing comes from the NanoRadar MR72 datasheet
obstacle_fr.x = ((frame.data[2] & 0x07U) * 256 + frame.data[3]) * 0.2 - 204.6;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a segfault risk if the CANFrame is shorter length than expected?

const AP_Param::GroupInfo AP_Proximity_MR72_CAN::var_info[] = {

// @Param: RECV_ID
// @DisplayName: CAN receive ID
Copy link
Contributor

Choose a reason for hiding this comment

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

Just regarding naming, "receive" is in the eye of the beholder -- one person's receive is another person's send so it doesn't add much clarity. maybe call it CAN_ID or just "ID".

Copy link
Contributor

@rmackay9 rmackay9 left a comment

Choose a reason for hiding this comment

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

Looks ok except for the name which we can do in a follow up PR

@tridge tridge merged commit b2dfd14 into ArduPilot:master Feb 5, 2024
92 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WikiNeeded needs wiki update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants