Skip to content

Commit

Permalink
Merge pull request #388 from farmerbriantee/611_Fixes
Browse files Browse the repository at this point in the history
611 fixes
  • Loading branch information
farmerbriantee authored Apr 8, 2024
2 parents 19f5d7a + 81663ec commit 1dba451
Show file tree
Hide file tree
Showing 36 changed files with 4,192 additions and 3,850 deletions.
7 changes: 3 additions & 4 deletions SourceCode/AgIO/Source/Forms/FormEthernet.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions SourceCode/AgIO/Source/Forms/FormKeyboard.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion SourceCode/AgIO/Source/Forms/FormKeyboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private void FormKeyboard_Load(object sender, EventArgs e)
string language = Properties.Settings.Default.setF_culture;
if (language == "fr")
{
this.Height = 640;
this.Height = 587;
}
else
{
Expand Down
3 changes: 3 additions & 0 deletions SourceCode/AgIO/Source/Forms/FormKeyboard.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="keyboard1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>
2 changes: 1 addition & 1 deletion SourceCode/AgIO/Source/Forms/FormLoop.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions SourceCode/GPS/AgOpenGPS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,8 @@
<None Include="btnImages\ABPivot.png" />
<None Include="btnImages\TrackPivot.png" />
<None Include="btnImages\Config\ConF_SoundSections.png" />
<None Include="btnImages\Config\ConD_LogElevation.png" />
<None Include="btnImages\Config\ConT_TramOverrideDisplay.png" />
<Content Include="Resources\TF012.WAV" />
<None Include="Resources\SectionOn.wav" />
<None Include="Resources\SectionOff.wav" />
Expand Down
34 changes: 32 additions & 2 deletions SourceCode/GPS/Classes/CABCurve.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,11 @@ public void BuildCurveCurrentList(vec3 pivot)
{
int ptCnt = curList.Count - 1;

bool isAdding = false;
//end
while (mf.bnd.bndList[0].fenceLineEar.IsPointInPolygon(curList[curList.Count - 1]))
{
isAdding = true;
for (int i = 1; i < 10; i++)
{
vec3 pt = new vec3(curList[ptCnt]);
Expand All @@ -350,11 +352,25 @@ public void BuildCurveCurrentList(vec3 pivot)
ptCnt = curList.Count - 1;
}

if (isAdding)
{
vec3 pt = new vec3(curList[curList.Count - 1]);
for (int i = 1; i < 5; i++)
{
pt.easting += (Math.Sin(pt.heading) * 2);
pt.northing += (Math.Cos(pt.heading) * 2);
curList.Add(pt);
}
}

isAdding = false;

//and the beginning
pt33 = new vec3(curList[0]);

while (mf.bnd.bndList[0].fenceLineEar.IsPointInPolygon(curList[0]))
{
isAdding = true;
pt33 = new vec3(curList[0]);

for (int i = 1; i < 10; i++)
Expand All @@ -365,6 +381,18 @@ public void BuildCurveCurrentList(vec3 pivot)
curList.Insert(0, pt);
}
}

if (isAdding)
{
vec3 pt = new vec3(curList[0]);
for (int i = 1; i < 5; i++)
{
pt.easting -= (Math.Sin(pt.heading) * 2);
pt.northing -= (Math.Cos(pt.heading) * 2);
curList.Insert(0, pt);
}
}

}
}
}
Expand All @@ -378,11 +406,13 @@ public void BuildCurveCurrentList(vec3 pivot)
- (mf.pivotAxlePos.northing - refPoint1.northing) * (mf.steerAxlePos.easting - refPoint1.easting)) < 0;

//how far are we away from the reference line at 90 degrees - 2D cross product and distance
distanceFromRefLine = glm.Distance(mf.guidanceLookPos, refPoint1);
distanceFromRefLine = glm.Distance(mf.pivotAxlePos, refPoint1);

distanceFromRefLine -= (0.5 * widthMinusOverlap);

double RefDist = (distanceFromRefLine + (isHeadingSameWay ? mf.tool.offset : -mf.tool.offset)) / widthMinusOverlap;
double RefDist = (distanceFromRefLine
+ (isHeadingSameWay ? mf.tool.offset : -mf.tool.offset)
+ mf.trk.gArr[idx].nudgeDistance) / widthMinusOverlap;

if (RefDist < 0) howManyPathsAway = (int)(RefDist - 0.5);
else howManyPathsAway = (int)(RefDist + 0.5);
Expand Down
10 changes: 5 additions & 5 deletions SourceCode/GPS/Classes/CGuidance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ public void StanleyGuidanceCurve(vec3 pivot, vec3 steer, ref List<vec3> curList)
//find the closest 2 points of pivot back from steer
for (int j = cc; j < dd; j++)
{
double dist = ((pivot.easting - curList[j].easting) * (pivot.easting - curList[j].easting))
+ ((pivot.northing - curList[j].northing) * (pivot.northing - curList[j].northing));
double dist = ((steer.easting - curList[j].easting) * (steer.easting - curList[j].easting))
+ ((steer.northing - curList[j].northing) * (steer.northing - curList[j].northing));
if (dist < minDistA)
{
minDistB = minDistA;
Expand Down Expand Up @@ -323,13 +323,13 @@ public void StanleyGuidanceCurve(vec3 pivot, vec3 steer, ref List<vec3> curList)
if (Math.Abs(dx) < Double.Epsilon && Math.Abs(dz) < Double.Epsilon) return;

//how far from current AB Line is fix
distanceFromCurrentLinePivot = ((dz * pivot.easting) - (dx * pivot.northing) + (pivB.easting
distanceFromCurrentLinePivot = ((dz * steer.easting) - (dx * steer.northing) + (pivB.easting
* pivA.northing) - (pivB.northing * pivA.easting))
/ Math.Sqrt((dz * dz) + (dx * dx));

mf.curve.distanceFromCurrentLinePivot = distanceFromCurrentLinePivot;
double U = (((pivot.easting - pivA.easting) * dx)
+ ((pivot.northing - pivA.northing) * dz))
double U = (((steer.easting - pivA.easting) * dx)
+ ((steer.northing - pivA.northing) * dz))
/ ((dx * dx) + (dz * dz));

rEastPivot = pivA.easting + (U * dx);
Expand Down
6 changes: 5 additions & 1 deletion SourceCode/GPS/Classes/CTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public class CTool
public int zones;
public int[] zoneRanges = new int[9];

public bool isDisplayTramControl;

//Constructor called by FormGPS
public CTool(FormGPS _f)
{
Expand Down Expand Up @@ -116,6 +118,8 @@ public CTool(FormGPS _f)
{
zoneRanges[i] = int.Parse(words[i]);
}

isDisplayTramControl = Properties.Settings.Default.setTool_isDisplayTramControl;
}

public void DrawTool()
Expand Down Expand Up @@ -371,7 +375,7 @@ public void DrawTool()
}

//tram Dots
if (mf.tram.displayMode != 0)
if (isDisplayTramControl && mf.tram.displayMode != 0)
{
if (mf.camera.camSetDistance > -300)
{
Expand Down
4 changes: 3 additions & 1 deletion SourceCode/GPS/Classes/CVehicle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class CVehicle
public double slowSpeedCutoff = 0;

//autosteer values
public double goalPointLookAhead, goalPointLookAheadHold, goalPointLookAheadMult;
public double goalPointLookAhead, goalPointLookAheadHold, goalPointLookAheadMult, uturnCompensation;

public double stanleyDistanceErrorGain, stanleyHeadingErrorGain;
public double minLookAheadDistance = 2.0;
Expand Down Expand Up @@ -97,6 +97,8 @@ public CVehicle(FormGPS _f)
functionSpeedLimit = Properties.Settings.Default.setAS_functionSpeedLimit;
maxSteerSpeed = Properties.Settings.Default.setAS_maxSteerSpeed;
minSteerSpeed = Properties.Settings.Default.setAS_minSteerSpeed;

uturnCompensation = Properties.Settings.Default.setAS_uTurnCompensation;
}

public int modeTimeCounter = 0;
Expand Down
24 changes: 14 additions & 10 deletions SourceCode/GPS/Classes/CYouTurn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,6 @@ private bool CreateCurveOmegaTurn(bool isTurnLeft, vec3 pivotPos)

//creates half a circle starting at the crossing point
ytList.Clear();
if (curveIndex >= mf.curve.curList.Count - 3 || curveIndex < 3)
{
FailCreate();
return false;
}

curveIndex += count;

Expand Down Expand Up @@ -2587,7 +2582,7 @@ public void BuildManualYouLateral(bool isTurnLeft)
double turnOffset = (mf.tool.width - mf.tool.overlap); //remove rowSkips

//if its straight across it makes 2 loops instead so goal is a little lower then start
if (!isHeadingSameWay) head += Math.PI;
if (!mf.isStanleyUsed &&!isHeadingSameWay) head += Math.PI;

//move the start forward 2 meters, this point is critical to formation of uturn
rEastYT += (Math.Sin(head) * 2);
Expand Down Expand Up @@ -2762,20 +2757,25 @@ public bool DistanceFromYouTurnLine()
//}

//feed backward to turn slower to keep pivot on
A -= 7;
if (A < 0)
{
A = 0;
}
B = A + 1;

//return and reset if too far away or end of the line
if (B >= ptCount - 8)
if (B >= ptCount - 1)
{
CompleteYouTurn();
return false;
}

if (uTurnStyle == 1 && pt3Phase == 0 && mf.isReverse)
{
CompleteYouTurn();
return true;
}

//get the distance from currently active AB line, precalc the norm of line
double dx = ytList[B].easting - ytList[A].easting;
double dz = ytList[B].northing - ytList[A].northing;
Expand Down Expand Up @@ -2820,7 +2820,7 @@ public bool DistanceFromYouTurnLine()
if (steerAngleYT < -0.74) steerAngleYT = -0.74;

//add them up and clamp to max in vehicle settings
steerAngleYT = glm.toDegrees((steerAngleYT + abFixHeadingDelta) * -1.0);
steerAngleYT = glm.toDegrees((steerAngleYT + abFixHeadingDelta * mf.vehicle.uturnCompensation) * -1.0);
if (steerAngleYT < -mf.vehicle.maxSteerAngle) steerAngleYT = -mf.vehicle.maxSteerAngle;
if (steerAngleYT > mf.vehicle.maxSteerAngle) steerAngleYT = mf.vehicle.maxSteerAngle;
}
Expand Down Expand Up @@ -2883,7 +2883,9 @@ public bool DistanceFromYouTurnLine()

//sharp turns on you turn.
//update base on autosteer settings and distance from line
double goalPointDistance = 0.8 * mf.vehicle.UpdateGoalPointDistance();
double goalPointDistance = mf.vehicle.UpdateGoalPointDistance();

//goalPointDistance *= mf.vehicle.uturnCompensation;

isHeadingSameWay = true;
bool ReverseHeading = !mf.isReverse;
Expand Down Expand Up @@ -2933,6 +2935,8 @@ public bool DistanceFromYouTurnLine()
steerAngleYT = glm.toDegrees(Math.Atan(2 * (((goalPointYT.easting - pivot.easting) * Math.Cos(localHeading))
+ ((goalPointYT.northing - pivot.northing) * Math.Sin(localHeading))) * mf.vehicle.wheelbase / goalPointDistanceSquared));

steerAngleYT *= mf.vehicle.uturnCompensation;

if (steerAngleYT < -mf.vehicle.maxSteerAngle) steerAngleYT = -mf.vehicle.maxSteerAngle;
if (steerAngleYT > mf.vehicle.maxSteerAngle) steerAngleYT = mf.vehicle.maxSteerAngle;

Expand Down
24 changes: 10 additions & 14 deletions SourceCode/GPS/Forms/Controls.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions SourceCode/GPS/Forms/Field/FormBndTool.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1dba451

Please sign in to comment.