-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
Conversation
ef1a937
to
e11ac2c
Compare
e11ac2c
to
de070c3
Compare
This has now been well tested by me and NanoRadar |
de070c3
to
5e643e4
Compare
@@ -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 |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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".
There was a problem hiding this 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
This adds support for the CAN variant of MR72.
http://en.nanoradar.cn/Article/detail/id/488.html