public MockRobot() { Head = new Head(Align.Normal, 0); LeftElbow = new Elbow(180); RightElbow = new Elbow(180); LeftWrist = new Wrist(0); RightWrist = new Wrist(0); }
public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hash = 17; hash = hash * 23 + Shoulder.GetHashCode(); hash = hash * 23 + Elbow.GetHashCode(); hash = hash * 23 + Wrist.GetHashCode(); return(hash); } }
public static IObservableBodyPart CreateElbow() { var elbowStateMachine = CreateElbowStateList(); var elbow = new Elbow() { Id = GenerateGuidId() }; elbow.SetStates(elbowStateMachine); return(elbow); }
public override bool Set(IModalityAccessor other) { var o = other as ArmModalityAccessor; if (o == null)//|| o.Side != Side && (o.Side!= SideType.None && Side!= SideType.None))//constraint on the side { return(false); } Enabled = o.Enabled; if (!Enabled) { return(true); } shoulder.Set(o.shoulder); Clavicle.Set(o.Clavicle); wrist.Set(o.wrist); Elbow.Set(o.Elbow); hand.Set(o.hand); return(true); }
public void StartArm() { // Initialize PortHandler Structs // Set the port path // Get methods and members of PortHandlerLinux or PortHandlerWindows port_num = dynamixel.portHandler(DEVICENAME); // Initialize PacketHandler Structs dynamixel.packetHandler(); // Open port if (dynamixel.openPort(port_num)) { Console.WriteLine("Succeeded to open the port!"); } else { Console.WriteLine("Failed to open the port!"); Console.WriteLine("Press any key to terminate..."); Console.ReadKey(); return; } // Set port baudrate if (dynamixel.setBaudRate(port_num, BAUDRATE)) { Console.WriteLine("Succeeded to change the baudrate!"); } else { Console.WriteLine("Failed to change the baudrate!"); Console.WriteLine("Press any key to terminate..."); Console.ReadKey(); return; } // enable the turret, shoulder, elbow and base Base.StartServo(port_num); Shoulder.StartServo(port_num); Elbow.StartServo(port_num); Gripper.StartServo(port_num); }
public Arm() { Elbow = new Elbow(this); Wrist = new Wrist(this); }
//Maybe more complex than necessary... public void SetTurnSpriteRotation(Elbow elbow) { turnSprite.gameObject.transform.rotation = Quaternion.Euler(0f, 0f, 0f); switch (elbow) { //Default is Up Right case Elbow.UpLeft: turnSprite.flipX = true; turnSprite.flipY = false; break; case Elbow.UpRight: turnSprite.flipX = false; turnSprite.flipY = false; break; case Elbow.DownRight: turnSprite.flipX = false; turnSprite.flipY = true; break; case Elbow.DownLeft: turnSprite.flipX = true; turnSprite.flipY = true; break; } }
public MockRobot WithRightElbowCollapsed() { RightElbow = new Elbow(45); return(this); }
public MockRobot WithLeftElbowCollapsed() { LeftElbow = new Elbow(45); return(this); }
/// <summary> /// The values to write to each servo to move the arm of the UGV to a postion that allows for optimal view of the main payload /// </summary> public void ArmSearchPosition() { Base.Move_To(Base_Search_Position); Shoulder.Move_To(Shoulder_Search_Position); Elbow.Move_To(Elbow_Search_Position); }
public LcarsMessageBox(object prompt, string title, MessageBoxButtons buttons, MessageBoxIcon icon) { buttonStyle = buttons; bool cancelVisible = false; bool abortVisible = false; bool retryVisible = false; bool ignoreVisible = false; bool yesVisible = false; bool noVisible = false; int okx = 183; int cx = 50; switch (buttons) { case MessageBoxButtons.OKCancel: cancelVisible = true; break; case MessageBoxButtons.AbortRetryIgnore: abortVisible = true; retryVisible = true; ignoreVisible = true; // cancelEnabled = true; cx = 210; okx = 115; break; case MessageBoxButtons.RetryCancel: retryVisible = true; cancelVisible = true; break; case MessageBoxButtons.YesNo: yesVisible = true; noVisible = true; okx = 210; cx = 115; break; case MessageBoxButtons.YesNoCancel: cancelVisible = true; yesVisible = true; noVisible = true; okx = 210; cx = 115; break; } LcarsColorFunction colorFunction; switch (icon) { case MessageBoxIcon.Error: //vbCritical colorFunction = LcarsColorFunction.FunctionOffline; // pass redAlert() to LCARSmain if exists. break; case MessageBoxIcon.Question: //vbQuestion colorFunction = LcarsColorFunction.StaticBlue; break; case MessageBoxIcon.Exclamation: //vbExclamation colorFunction = LcarsColorFunction.StaticTan; break; case MessageBoxIcon.Information: //vbInformation colorFunction = LcarsColorFunction.LCARSDisplayOnly; break; default: colorFunction = LcarsColorFunction.StaticTan; break; } FormBorderStyle = FormBorderStyle.None; Size = new Size(305, 200); BackColor = Color.Black; StartPosition = FormStartPosition.CenterScreen; TopMost = true; Elbow elbow1 = new Elbow(); Controls.Add(elbow1); elbow1.Location = new Point(0, 0); elbow1.Size = new Size(80, 60); elbow1.HorizantalBarHeight = 30; elbow1.VerticalBarWidth = 10; elbow1.ElbowStyle = LcarsElbowStyle.UpperLeft; elbow1.ColorFunction = colorFunction; elbow1.Text = ""; Elbow elbow2 = new Elbow(); Controls.Add(elbow2); elbow2.Location = new Point(0, 140); elbow2.Size = new Size(80, 60); elbow2.HorizantalBarHeight = 15; elbow2.VerticalBarWidth = 10; elbow2.Clickable = false; elbow2.ElbowStyle = LcarsElbowStyle.LowerLeft; elbow2.ColorFunction = colorFunction; elbow2.Text = ""; TextButton titleBar = new TextButton(); Controls.Add(titleBar); titleBar.Location = new Point(50, 0); titleBar.Size = new Size(255, 30); titleBar.TextHeight = 31; titleBar.ColorFunction = colorFunction; titleBar.Text = title; FlatButton vertBar = new FlatButton(); Controls.Add(vertBar); vertBar.Location = new Point(0, 66); vertBar.Size = new Size(10, 68); vertBar.Clickable = false; vertBar.ColorFunction = colorFunction; vertBar.Text = ""; HalfPillButton bottomBar = new HalfPillButton(); Controls.Add(bottomBar); bottomBar.Location = new Point(85, 185); bottomBar.Size = new Size(217, 15); bottomBar.Clickable = false; bottomBar.ColorFunction = colorFunction; bottomBar.Text = ""; //draw text RichTextBox errorTextBox = new RichTextBox(); Controls.Add(errorTextBox); errorTextBox.Location = new Point(30, 36); errorTextBox.Size = new Size(243, 107); errorTextBox.BackColor = Color.Black; errorTextBox.BorderStyle = BorderStyle.None; errorTextBox.WordWrap = true; errorTextBox.Font = FontProvider.Lcars(14); errorTextBox.ForeColor = Color.Orange; errorTextBox.BringToFront(); errorTextBox.Text = prompt.ToString(); errorTextBox.ReadOnly = true; // BUTTONS //draw OK/Yes/retry button StandardButton yesOkRetryButton = new StandardButton(); Controls.Add(yesOkRetryButton); yesOkRetryButton.Location = new Point(okx, 149); yesOkRetryButton.Size = new Size(90, 30); yesOkRetryButton.ColorFunction = LcarsColorFunction.PrimaryFunction; yesOkRetryButton.Name = "yesOkRetryButton"; if (yesVisible) { yesOkRetryButton.Text = "YES"; yesOkRetryButton.Click += OnYesClick; } else if (retryVisible) { yesOkRetryButton.Text = "RETRY"; yesOkRetryButton.Click += OnRetryClick; } else { yesOkRetryButton.Text = "OK"; yesOkRetryButton.Click += OnOkClick; } yesOkRetryButton.ButtonTextAlign = ContentAlignment.MiddleCenter; yesOkRetryButton.BringToFront(); if (cancelVisible || ignoreVisible) { StandardButton cancelIgnoreButton = new StandardButton(); Controls.Add(cancelIgnoreButton); cancelIgnoreButton.Location = new Point(cx, 149); cancelIgnoreButton.Size = new Size(90, 30); cancelIgnoreButton.Name = "cancelIgnoreButton"; cancelIgnoreButton.ColorFunction = LcarsColorFunction.CriticalFunction; if (ignoreVisible) { cancelIgnoreButton.Text = "IGNORE"; cancelIgnoreButton.Click += OnIgnoreClick; } else if (cancelVisible) { cancelIgnoreButton.Text = "CANCEL"; cancelIgnoreButton.Click += OnCancelClick; } cancelIgnoreButton.ButtonTextAlign = ContentAlignment.MiddleCenter; cancelIgnoreButton.BringToFront(); } if (abortVisible || noVisible) { //draw abort/no button StandardButton noAbortButton = new StandardButton(); Controls.Add(noAbortButton); noAbortButton.Location = new Point(20, 149); noAbortButton.Size = new Size(90, 30); noAbortButton.ColorFunction = LcarsColorFunction.CriticalFunction; if (abortVisible) { noAbortButton.Text = "ABORT"; noAbortButton.Click += OnAbortClick; } else if (noVisible) { noAbortButton.Text = "NO"; noAbortButton.Click += OnNoClick; } noAbortButton.ButtonTextAlign = ContentAlignment.MiddleCenter; noAbortButton.BringToFront(); } KeyPreview = true; KeyDown += Me_KeyDown; elbow1.MouseDown += Title_MouseDown; elbow1.MouseMove += Title_MouseMove; titleBar.MouseDown += Title_MouseDown; titleBar.MouseMove += Title_MouseMove; }