Пример #1
0
    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();
        }
    }
Пример #2
0
    void Update()
    {
        // manual input
        float             input             = Input.GetAxis("Fingers");
        PincherController pincherController = hand.GetComponent <PincherController>();

        pincherController.gripState = GripStateForInput(input);
    }
Пример #3
0
    void Start()
    {
        robotController         = robot.GetComponent <RobotController>();
        touchDetector           = cube.GetComponent <TouchDetector>();
        tablePositionRandomizer = cube.GetComponent <TablePositionRandomizer>();

        pinchDetector     = cube.GetComponent <PinchDetector>();
        pincherController = endEffector.GetComponent <PincherController>();
    }
Пример #4
0
 void Start()
 {
     pincherController = hand.GetComponent <PincherController>();
 }