public override void OnActionReceived(float[] vectorAction) { RobotController robotController = robotArm.GetComponent <RobotController>(); PincherController pincherController = robotHand.GetComponent <PincherController>(); for (int i = 0; i < robotController.joints.Length + 1; i++) { float inputVal = vectorAction[i]; if (i == 7) { pincherController.gripState = GripStateForInput(inputVal); } else { if (Mathf.Abs(inputVal) > 0) { RotationDirection direction = GetRotationDirection(inputVal); robotController.RotateJoint(i, direction); return; } } } robotController.StopAllJointRotations(); if (cube.position.y < 0.778f) { EndEpisode(); } }
void Update() { // manual input float input = Input.GetAxis("Fingers"); PincherController pincherController = hand.GetComponent <PincherController>(); pincherController.gripState = GripStateForInput(input); }
void Start() { robotController = robot.GetComponent <RobotController>(); touchDetector = cube.GetComponent <TouchDetector>(); tablePositionRandomizer = cube.GetComponent <TablePositionRandomizer>(); pinchDetector = cube.GetComponent <PinchDetector>(); pincherController = endEffector.GetComponent <PincherController>(); }
void Start() { pincherController = hand.GetComponent <PincherController>(); }