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: correct unit handling for radius #3262

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static GMapMarker getMAVMarker(MAVState MAV, GMapOverlay overlay = null)
itemp.Cog = MAV.cs.groundcourse;
itemp.Target = MAV.cs.target_bearing;
itemp.Nav_bearing = MAV.cs.nav_bearing;
itemp.Radius = MAV.cs.radius * CurrentState.multiplierdist;
itemp.Radius = (float)CurrentState.fromDistDisplayUnit(MAV.cs.radius);
return null;
}
else if (item is GMapMarkerQuad)
Expand Down Expand Up @@ -76,7 +76,7 @@ public static GMapMarker getMAVMarker(MAVState MAV, GMapOverlay overlay = null)
{
return (new GMapMarkerPlane(MAV.sysid - 1, portlocation, MAV.cs.yaw,
MAV.cs.groundcourse, MAV.cs.nav_bearing, MAV.cs.target_bearing,
MAV.cs.radius * CurrentState.multiplierdist)
(float)CurrentState.toDistDisplayUnit(MAV.cs.radius))
{
ToolTipText = ArduPilot.Common.speechConversion(MAV, "" + Settings.Instance["mapicondesc"]),
ToolTipMode = String.IsNullOrEmpty(Settings.Instance["mapicondesc"]) ? MarkerTooltipMode.Never : MarkerTooltipMode.Always,
Expand Down
2 changes: 1 addition & 1 deletion ExtLibs/ArduPilot/CurrentState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ public float radius
get
{
if (_groundspeed <= 1) return 0;
return (float)(groundspeed * groundspeed / (9.80665 * Math.Tan(roll * MathHelper.deg2rad)));
return (float)toDistDisplayUnit(_groundspeed * _groundspeed / (9.80665 * Math.Tan(roll * MathHelper.deg2rad)));
}
}
[GroupText("Position")]
Expand Down
2 changes: 1 addition & 1 deletion Swarm/Formation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public override void SendCommand()

if (true)
{
var leaderturnrad = Leader.cs.radius;
var leaderturnrad = CurrentState.fromDistDisplayUnit(Leader.cs.radius);
var mavturnradius = leaderturnrad - x;

{
Expand Down
Loading