private void HDG() { if (Event.current.Equals(Event.KeyboardEvent("return")) && GUI.GetNameOfFocusedControl().StartsWith("RC")) { mFlightComputer.Enqueue(DriveCommand.DistanceHeading(Dist, Heading, mSteerClamp, Speed)); } GUILayout.BeginHorizontal(); { GUILayout.Label(new GUIContent("Wheel: ", "How sharp to turn at max")); GUILayout.FlexibleSpace(); GUILayout.Label(new GUIContent(mSteerClamp.ToString("P"), "How sharp to turn at max")); GUILayout.Label(new GUIContent("max", "How sharp to turn at max"), GUILayout.Width(40)); } GUILayout.EndHorizontal(); RTUtil.HorizontalSlider(ref mSteerClamp, 0, 1); GUILayout.BeginHorizontal(); { GUILayout.Label(new GUIContent("Hdg.", "Heading to keep"), GUILayout.Width(50)); GUI.SetNextControlName("RC1"); RTUtil.TextField(ref Mheading, GUILayout.Width(50), GUILayout.ExpandWidth(false)); GUILayout.Label("(°)", GUI.skin.textField, GUILayout.Width(40)); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { GUILayout.Label(new GUIContent("Dist.", "Distance to drive"), GUILayout.Width(50)); GUI.SetNextControlName("RC2"); RTUtil.TextField(ref mDist, GUILayout.Width(50), GUILayout.ExpandWidth(false)); GUILayout.Label("(m)", GUI.skin.textField, GUILayout.Width(40)); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { GUILayout.Label(new GUIContent("Speed", "Speed to keep"), GUILayout.Width(50)); GUI.SetNextControlName("RC3"); RTUtil.TextField(ref mSpeed, GUILayout.Width(50), GUILayout.ExpandWidth(false)); GUILayout.Label(new GUIContent("(m/s)", "Speed to keep"), GUI.skin.textField, GUILayout.Width(40)); } GUILayout.EndHorizontal(); Mheading = RTUtil.ConstrictNum(Mheading, 360); mDist = RTUtil.ConstrictNum(mDist, false); mSpeed = RTUtil.ConstrictNum(mSpeed, false); }
private void OnExecClick(int modeIndex) { //FINE if (modeIndex == (int)RoverModes.FineMode && Speed != 0) { if (mSteering != 0 && Turn != 0) { EnqueueTurn(); } else if (Dist != 0) { EnqueueDist(); } else { if (!distDefault && mSteering != 0 && Turn != 0) { EnqueueTurn(); } else if (distDefault && Dist != 0) { EnqueueDist(); } } } //HDG else if (modeIndex == (int)RoverModes.HeadingMode) { mFlightComputer.Enqueue(DriveCommand.DistanceHeading(Dist, Heading, mSteerClamp, Speed)); } //TGT else if (modeIndex == (int)RoverModes.TargetMode) { mFlightComputer.Enqueue(DriveCommand.Coord(mSteerClamp, Latitude, Longitude, Speed)); } }