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

CurrentState: add more rangefinders #3209

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions ExtLibs/ArduPilot/CurrentState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1653,10 +1653,17 @@ public float sonarrange
[DisplayText("Sonar Voltage (Volt)")][GroupText("Sensor")] public float sonarvoltage { get; set; }

[DisplayText("RangeFinder1 (cm)")][GroupText("Sensor")] public uint rangefinder1 { get; set; }

[DisplayText("RangeFinder2 (cm)")][GroupText("Sensor")] public uint rangefinder2 { get; set; }

[DisplayText("RangeFinder3 (cm)")][GroupText("Sensor")] public uint rangefinder3 { get; set; }
[DisplayText("RangeFinder4 (cm)")][GroupText("Sensor")] public uint rangefinder4 { get; set; }
[DisplayText("RangeFinder5 (cm)")][GroupText("Sensor")] public uint rangefinder5 { get; set; }
[DisplayText("RangeFinder6 (cm)")][GroupText("Sensor")] public uint rangefinder6 { get; set; }
[DisplayText("RangeFinder7 (cm)")][GroupText("Sensor")] public uint rangefinder7 { get; set; }
[DisplayText("RangeFinder8 (cm)")][GroupText("Sensor")] public uint rangefinder8 { get; set; }
[DisplayText("RangeFinder9 (cm)")][GroupText("Sensor")] public uint rangefinder9 { get; set; }
[DisplayText("RangeFinder10 (cm)")][GroupText("Sensor")] public uint rangefinder10 { get; set; }


[GroupText("Software")]
public float freemem { get; set; }
[GroupText("Software")] public float load { get; set; }
Expand Down Expand Up @@ -2476,11 +2483,16 @@ private void Parent_OnPacketReceived(object sender, MAVLink.MAVLinkMessage mavLi

{
var sonar = mavLinkMessage.ToStructure<MAVLink.mavlink_distance_sensor_t>();
if (sonar.id == 0)
rangefinder1 = sonar.current_distance;
else if (sonar.id == 1)
rangefinder2 = sonar.current_distance;
if (sonar.id == 0) rangefinder1 = sonar.current_distance;
else if (sonar.id == 1) rangefinder2 = sonar.current_distance;
else if (sonar.id == 2) rangefinder3 = sonar.current_distance;
else if (sonar.id == 3) rangefinder4 = sonar.current_distance;
else if (sonar.id == 4) rangefinder5 = sonar.current_distance;
else if (sonar.id == 5) rangefinder6 = sonar.current_distance;
else if (sonar.id == 6) rangefinder7 = sonar.current_distance;
else if (sonar.id == 7) rangefinder8 = sonar.current_distance;
else if (sonar.id == 8) rangefinder9 = sonar.current_distance;
else if (sonar.id == 9) rangefinder10 = sonar.current_distance;
}

break;
Expand Down
Loading