public void BuildRobotArms() { var left = new RobotArm("ArmyRobot - Left"); var right = new RobotArm("ArmyRobot - Right"); _robot.SetRobotArms(left, right); }
// Use this for initialization void Start() { onTrack = false; InitialiseTimer(); arm = GetComponent <RobotArm>(); }
public void BuildRobotArms() { var left = new RobotArm("HomeKeeper - Left"); var right = new RobotArm("HomeKeeper - Right"); _robot.SetRobotArms(left, right); }
void Update() { // If myDigitalArmControl has not been wired up on Awake exit if (myDigitalArmControl == null) { return; } // Make sure X never goes under 0 and Y under 1 (arm design constraints) if (xPos < 0.1f) { xPos = 0.1f; } if (yPos < 1) { yPos = 1; } // Converts cartesian coordinates into servo Angles using a dedicated library ArmAngles myArmAngles = RobotArm.CartesianToServo(xPos, yPos, armLength); // Write servo angles in myDigitalArmControl script myDigitalArmControl.baseServoAngle = myArmAngles.baseAngle; myDigitalArmControl.jointServoAngle = myArmAngles.jointAngle; }
/// <summary> /// A button click event to perform Get Wafer from a location (station+slot) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GetBTN_Click(object sender, EventArgs e) { if (connection.isConnected()) { string rbt = RobotCB.Text; string hand = RbtHandCB.Text; string lp = LoadPortCB.Text; string slot = LPSlotCB.Text; if (String.IsNullOrEmpty(rbt)) { MessageBox.Show("Please select Robot"); } if (String.IsNullOrEmpty(lp)) { MessageBox.Show("Please select a Load Port"); } if (String.IsNullOrEmpty(hand)) { MessageBox.Show("Please select a Load Port"); } /*Get selected robot hand in type of RobotArm enum */ RobotArm Hand = new RobotArm(); switch (hand) { case "H1": Hand = RobotArm.ARM_1; break; case "H2": Hand = RobotArm.ARM_2; break; } /*Construct and send the command to server accordingly */ switch (lp) { case "Load Port1": string cmd1 = R1.GetWafer(Hand, LP1, (LoadPortSlot)Convert.ToInt32(slot)); ULTMServices.sendCommand(cmd1); commandLogger.Log($"{cmd1}"); break; case "Load Port2": string cmd2 = R1.GetWafer(Hand, LP2, (LoadPortSlot)Convert.ToInt32(slot)); ULTMServices.sendCommand(cmd2); commandLogger.Log($"{cmd2}"); break; } ; this.TerminalRTB.Invoke(new MethodInvoker(delegate() { TerminalRTB.AppendText(Environment.NewLine + Environment.NewLine + "Client>>Server:Get"); })); } else { errorLogger.Log("Robot is not connected"); } }
void readJSON(string json) { RobotArm arm = JsonUtility.FromJson <RobotArm>(@json); for (int i = 0; i < 6; i++) { jointCmds[i] = arm.joint_angles[i]; } }
private JointAngles GetJointAngles(double x, double y, double z) { z = z + RobotArm.EndEffectorLength; Vector3 wristLocation = new Vector3(x, y, z); JointAngles jointAngles = RobotArm.DoInverseKinematics(wristLocation); jointAngles.WristTiltAngle = GetWristTiltAngleForVertical(jointAngles); return(jointAngles); }
private JointAngles GetJointAngles(double x, double y, double z, bool zIsBasedOnEndeffectorTip) { if (zIsBasedOnEndeffectorTip) { z = z + RobotArm.EndEffectorLength; } Vector3 wristLocation = new Vector3(x, y, z); JointAngles jointAngles = RobotArm.DoInverseKinematics(wristLocation); return(jointAngles); }
static List <Mesh> PoseMeshesRobot(RobotArm arm, IList <Plane> planes, Mesh tool) { planes = planes.ToList(); var count = planes.Count - 1; planes.RemoveAt(count); planes.Add(planes[count - 1]); var defaultPlanes = arm.Joints.Select(m => m.Plane).Prepend(arm.BasePlane).Append(Plane.WorldXY).ToList(); var defaultMeshes = arm.Joints.Select(m => m.Mesh).Prepend(arm.BaseMesh).Append(tool); var outMeshes = defaultMeshes.Select(m => m.DuplicateMesh()).ToList(); for (int i = 0; i < defaultPlanes.Count; i++) { var s = Transform.PlaneToPlane(defaultPlanes[i], planes[i]); outMeshes[i].Transform(s); } return(outMeshes); }
static void Main(string[] args) { try { Vector3 wristLocation = new Vector3(RobotArm.ForearmLength, 0, RobotArm.ShoulderHeight + RobotArm.UpperArmLength); JointAngles jointAngles = RobotArm.DoInverseKinematics(wristLocation); Debug.WriteLine(jointAngles); //DHFrameInfo[] frameInfos = new DHFrameInfo[] // { // new DHFrameInfo(0, 90, 60, 90), // new DHFrameInfo(100, 0, 0, 90), // //new DHFrameInfo(3, 0, 0, 0), // }; //Matrix4x4[] transformations = new Matrix4x4[frameInfos.Length]; //Matrix4x4 completeTransformation = Matrix4x4.Identity; //for (int i = frameInfos.Length - 1; i >= 0; i--) //{ // transformations[i] = DHTransformation.ToPreviousFrame(frameInfos[i]); // completeTransformation = transformations[i] * completeTransformation; //} //Vector4 vector1 = new Vector4(0, 0, 0); //Vector4 transformedVector = completeTransformation * vector1; //System.Console.WriteLine(transformedVector); } catch (Exception ex) { System.Console.WriteLine(ex.ToString()); } finally { System.Console.ReadLine(); } }
// Use this for initialization void Start() { _robotArmController = RobotArm.GetComponent <RobotArm>(); }
protected RobotKinematics(RobotArm robot, Target target, double[]?prevJoints = null, Plane?basePlane = null) : base(robot, target, prevJoints, basePlane) { }
public Robot WithRightArm(RobotArm rightArm) { return(With(rightArm.Prop)); }
public Robot WithLeftArm(RobotArm leftArm) { return(With(leftArm.Prop)); }
// Use this for initialization void Start() { startOffset = transform.localPosition; _arm = GetComponentInParent <RobotArm>(); }
// Start is called before the first frame update void Start() { robotArm = GetComponent <RobotArm> (); }
public OffsetWristKinematics(RobotArm robot, Target target, double[]?prevJoints, Plane?basePlane) : base(robot, target, prevJoints, basePlane) { }
/// <summary> /// A button click event to perform Transfer a wafer from a location(station+slot) to an another location(station+slot) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TransferBTN_Click(object sender, EventArgs e) { if (connection.isConnected()) { string rbt = RobotCB.Text; string hand = RbtHandCB.Text; string source = SourceCB.Text; string sourSlot = SrcSlotCB.Text; string destination = DestinationCB.Text; string destSlot = DstSlotCB.Text; if (String.IsNullOrEmpty(rbt)) { MessageBox.Show("Please select Robot"); } if (String.IsNullOrEmpty(hand)) { MessageBox.Show("Please select a Load Port"); } /*Get selected robot hand in type of RobotArm enum */ RobotArm Hand = new RobotArm(); switch (hand) { case "H1": Hand = RobotArm.ARM_1; break; case "H2": Hand = RobotArm.ARM_2; break; } /*Construct and send the command to server accordingly */ string cmd = ""; switch (source) { case "Load Port1": switch (destination) { case "Load Port1": cmd = R1.Tranfer(Hand, LP1, (LoadPortSlot)Convert.ToInt32(sourSlot), LP1, (LoadPortSlot)Convert.ToInt32(destSlot)); ULTMServices.sendCommand(cmd); commandLogger.Log(cmd); break; case "Load Port2": cmd = R1.Tranfer(Hand, LP1, (LoadPortSlot)Convert.ToInt32(sourSlot), LP2, (LoadPortSlot)Convert.ToInt32(destSlot)); ULTMServices.sendCommand(cmd); commandLogger.Log(cmd); break; } break; case "Load Port2": switch (destination) { case "Load Port1": cmd = R1.Tranfer(Hand, LP2, (LoadPortSlot)Convert.ToInt32(sourSlot), LP1, (LoadPortSlot)Convert.ToInt32(destSlot)); ULTMServices.sendCommand(cmd); commandLogger.Log(cmd); break; case "Load Port2": cmd = R1.Tranfer(Hand, LP2, (LoadPortSlot)Convert.ToInt32(sourSlot), LP2, (LoadPortSlot)Convert.ToInt32(destSlot)); ULTMServices.sendCommand(cmd); commandLogger.Log(cmd); break; } break; } this.TerminalRTB.Invoke(new MethodInvoker(delegate() { TerminalRTB.AppendText(Environment.NewLine + Environment.NewLine + "Client>>Server:Transfer"); })); } else { errorLogger.Log("Robot is not connected"); } }
public override void InitializeAgent() { brainConfig = 1; SetupEvents(); robotArm = GetComponent <RobotArm> (); area = GetComponentInParent <Area> (); // when the arm is holding an object robotArm.OnHoldingObject = () => { if (brain != NoTargetBrain) { // just call when the arm holds an object for the first time in the episode if (!HeldAlready) { HeldAlready = true; if (area.IsTrainingArea()) { agentParameters.maxStep = GetStepCount() + 2000; } // add reward for holding object AddReward(4f); // done if flag set if (DoneOnPickup) { Debug.Log("Pick Success with: " + GetCumulativeReward()); Done(); } else { // reset cummulative reward for the next brain AddReward(-1f * GetCumulativeReward()); } } if (!DoneOnPickup) { // change brain to drop brain brainConfig = 2; // called when the holding object touches ground robotArm.holdingObject.GetComponent <TargetCollision> ().OnGroundCollision = () => { // if touched ground and is not holding object but held it already if (!robotArm.IsHoldingObject() && HeldAlready) { // negative reward for dropping object AddReward(-1f); //GiveBrain (PickupBrain); Done(); } }; } } }; // negative reward when the arm hit other objects than the target robotArm.OnCollision = (Collision other) => { if (!other.gameObject.CompareTag("Target")) { AddReward(-0.04f); } }; }
/// <summary> /// A button click event to perform robot move to a selected location code of selected slot of selected station /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MoveBTN_Click(object sender, EventArgs e) { if (connection.isConnected()) { string rbt = RobotCB.Text; string hand = RbtHandCB.Text; string lp = LoadPortCB.Text; string slot = LPSlotCB.Text; string locationCode = locationCodeCB.Text; if (String.IsNullOrEmpty(locationCode)) { MessageBox.Show("Please select Location Code"); } if (String.IsNullOrEmpty(rbt)) { MessageBox.Show("Please select Robot"); } if (String.IsNullOrEmpty(lp)) { MessageBox.Show("Please select a Load Port"); } if (String.IsNullOrEmpty(hand)) { MessageBox.Show("Please select a Load Port"); } /*Get selected robot hand in type of RobotArm enum */ RobotArm Hand = new RobotArm(); switch (hand) { case "H1": Hand = RobotArm.ARM_1; break; case "H2": Hand = RobotArm.ARM_2; break; } /*Get selected location code in type of LocationCode enum */ LocationCode LC = new LocationCode(); switch (locationCode) { case "pbx": LC = LocationCode.pbx; break; case "gbx": LC = LocationCode.gbx; break; } /*Construct and send the command to server accordingly */ string cmd = ""; switch (lp) { case "Load Port1": ULTMServices.sendCommand(R1.Move(Hand, LP1, (LoadPortSlot)Convert.ToInt32(slot), LC)); break; case "Load Port2": ULTMServices.sendCommand(R1.Move(Hand, LP1, (LoadPortSlot)Convert.ToInt32(slot), LC)); break; } this.TerminalRTB.Invoke(new MethodInvoker(delegate() { TerminalRTB.AppendText(Environment.NewLine + Environment.NewLine + "Client>>Server:Move"); })); } else { errorLogger.Log("Robot is not connected"); } }
public void SetRobotArms(RobotArm leftArm, RobotArm rightArm) { LeftArm = leftArm; RightArm = rightArm; }
void OnCollisionEnter2D(Collision2D collision) { bool hell = false; //collision with ff FerrofluidScript goo = collision.gameObject.GetComponent <FerrofluidScript> (); HealthScript playerHealth = GetComponent <HealthScript> (); FloorScript floor = collision.gameObject.GetComponent <FloorScript> (); PopUpScript popUp = collision.gameObject.GetComponent <PopUpScript> (); BossFight boss = collision.gameObject.GetComponent <BossFight> (); ShieldScript shield = collision.gameObject.GetComponent <ShieldScript> (); ShieldNumber shieldnumber = collision.gameObject.GetComponent <ShieldNumber> (); FfScript ffBottle = collision.gameObject.GetComponent <FfScript> (); WingsCounter wings = collision.gameObject.GetComponent <WingsCounter> (); RobotArm robot = GetComponent <RobotArm> (); OrangeCell orangeCell = collision.gameObject.GetComponent <OrangeCell>(); RedCell redCell = collision.gameObject.GetComponent <RedCell>(); BlueCell blueCell = collision.gameObject.GetComponent <BlueCell>(); MetalCell metalCell = collision.gameObject.GetComponent <MetalCell>(); MazePlatform maze = collision.gameObject.GetComponent <MazePlatform>(); //BridgePlatformScript bridge = GetComponent<BridgePlatformScript> (); if (collision.gameObject.tag == "orange") { // damagePlayer = true; // Debug.Log("shield not hit"); // if(playerHealth != null) // playerHealth.Damage(orangeCell.damage,respawnPosX,respawnPosY,false); if (shieldGO.activeSelf == true) { damagePlayer = false; shieldHits--; metalCell.hitByShield = true; Debug.Log("shield hit"); //orangeCell = null; if (playerHealth != null) { playerHealth.Damage(orangeCell.damage, respawnPosX, respawnPosY, true); } } else { damagePlayer = true; Debug.Log("shield not hit"); if (playerHealth != null) { playerHealth.Damage(orangeCell.damage, respawnPosX, respawnPosY, false); } } } if (collision.gameObject.tag == "red") { damagePlayer = true; Debug.Log("shield not hit"); if (playerHealth != null) { playerHealth.Damage(redCell.damage, respawnPosX, respawnPosY, false); } } if (collision.gameObject.tag == "blue") { damagePlayer = true; Debug.Log("shield not hit"); if (playerHealth != null) { playerHealth.Damage(blueCell.damage, respawnPosX, respawnPosY, false); } } if (collision.gameObject.tag == "metal") { // damagePlayer = true; // Debug.Log("shield not hit"); // if(playerHealth != null) // playerHealth.Damage(orangeCell.damage,respawnPosX,respawnPosY,false); if (shieldGO.activeSelf == true) { damagePlayer = false; shieldHits--; metalCell.hitByShield = true; Debug.Log("shield hit"); } else { damagePlayer = true; Debug.Log("shield not hit"); if (playerHealth != null) { playerHealth.Damage(orangeCell.damage, respawnPosX, respawnPosY, false); } } } if (floor != null) { damagePlayer = true; hell = true; } if (hell) { if (playerHealth != null) { playerHealth.Damage(floor.damage, respawnPosX, respawnPosY, false); } } if (collision.gameObject.name == "Checkpoint1") { CheckpointScript checkpoint = collision.gameObject.GetComponent <CheckpointScript>(); respawnPosX = checkpoint.posX; respawnPosY = checkpoint.posY; Destroy(collision.gameObject.GetComponent <Collider2D>()); } if (collision.gameObject.name == "Checkpoint2") { CheckpointScript checkpoint = collision.gameObject.GetComponent <CheckpointScript>(); respawnPosX = checkpoint.posX; respawnPosY = checkpoint.posY; Destroy(collision.gameObject.GetComponent <Collider2D>()); } if (collision.gameObject.name == "Checkpoint3") { CheckpointScript checkpoint = collision.gameObject.GetComponent <CheckpointScript>(); respawnPosX = checkpoint.posX; respawnPosY = checkpoint.posY; Destroy(collision.gameObject.GetComponent <Collider2D>()); } if (collision.gameObject.name == "Checkpoint4") { CheckpointScript checkpoint = collision.gameObject.GetComponent <CheckpointScript>(); respawnPosX = checkpoint.posX; respawnPosY = checkpoint.posY; Destroy(collision.gameObject.GetComponent <Collider2D>()); } // if (collision.gameObject.name == "atomo") { // popUp.showPopUp = true; // popUp.gameObject.GetComponent<Renderer>().enabled = false; // Destroy(popUp.gameObject.GetComponent<Collider2D>()); // } if (collision.gameObject.tag == "MovingPlatform") { this.transform.parent = collision.transform; } // if (collision.gameObject.tag == "lever"){ // RobotArm.move = true; // } // // if (collision.gameObject.tag == "lever1") { // RobotArm.move1 = true; // } if (collision.gameObject.tag == "Boss") { boss.gameObject.GetComponent <Renderer>().enabled = true; showPopUp = true; maxSpeed = 0; if (i == 5) { maxSpeed = 25; Destroy(boss.gameObject); boss.gameObject.GetComponent <Renderer>().enabled = false; } } if (collision.gameObject.tag == "Door") { Application.LoadLevel("Hidrofobia"); } if (wings != null) { wings.GetComponent <Renderer>().enabled = false; wings.GetComponent <PolygonCollider2D>().enabled = false; wingsCounter = 7; } if (collision.gameObject.tag == "shield") { ShieldCounterManager.AddShield(shieldnumber.shieldNumber); Destroy(shieldnumber.gameObject); shieldFlag = true; Debug.Log("Shield available"); } if (collision.gameObject.tag == "ffbottle") { FfCounterManager.AddFF(ffBottle.ffNumber); gunFlag = true; Destroy(ffBottle.gameObject); } //platform activator if (collision.gameObject.tag == "ActivatePlatform") { collision.gameObject.GetComponent <Animator>().enabled = true; } if (collision.gameObject.tag == "Boots") { collision.gameObject.GetComponent <Renderer>().enabled = false; collision.gameObject.GetComponent <PolygonCollider2D>().enabled = false; time = 5; } if (collision.gameObject.tag == "box") { bool founded = false; BoxController box = collision.gameObject.GetComponent <BoxController>(); box.Founded(true); Destroy(collision.gameObject); } if (collision.gameObject.tag == "Bridge1") { BridgePlatformScript.bridge1 = true; } if (collision.gameObject.tag == "Bridge2") { BridgePlatformScript.bridge2 = true; } if (collision.gameObject.tag == "Bridge3") { BridgePlatformScript.bridge3 = true; } if (collision.gameObject.tag == "Bridge4") { BridgePlatformScript.bridge4 = true; } if (collision.gameObject.tag == "Bridge5") { BridgePlatformScript.bridge5 = true; } if (collision.gameObject.tag == "Bridge6") { BridgePlatformScript.bridge6 = true; } if (collision.gameObject.tag == "Bridge7") { BridgePlatformScript.bridge7 = true; } if (collision.gameObject.name == "MetallicFloorFerroFluidMAP 159") { MazePlatform.ground = true; transform.parent = collision.transform; } }
private void Start() { robotArm = GetComponentInParent <RobotArm> (); }