Esempio n. 1
0
    /// <summary>
    /// Called once every physics step (framerate independent) to drive motor joints as well as handle the resetting of the robot
    /// </summary>
    void FixedUpdate()
    {
        if (rootNode != null && ControlsEnabled)
        {
            if (Packet != null)
            {
                DriveJoints.UpdateAllMotors(rootNode, Packet.dio, ControlIndex, RobotIsMecanum);
            }
            else
            {
                DriveJoints.UpdateAllMotors(rootNode, emptyDIO, ControlIndex, RobotIsMecanum);
            }

            if (RobotHasManipulator)
            {
                DriveJoints.UpdateManipulatorMotors(manipulatorNode, emptyDIO, ControlIndex);
            }
        }

        if (IsResetting)
        {
            Resetting();
        }

        UpdateStats();
    }
Esempio n. 2
0
    /// <summary>
    /// Called once every physics step (framerate independent) to drive motor joints as well as handle the resetting of the robot
    /// </summary>
    void FixedUpdate()
    {
        if (rootNode != null && ControlsEnabled)
        {
            if (Packet != null)
            {
                DriveJoints.UpdateAllMotors(rootNode, Packet.dio, controlIndex, MixAndMatchMode.GetMecanum());
            }
            else
            {
                DriveJoints.UpdateAllMotors(rootNode, emptyDIO, controlIndex, MixAndMatchMode.GetMecanum());
            }
            int isMixAndMatch = PlayerPrefs.GetInt("mixAndMatch", 0); //0 is false, 1 is true

            //If the robot is in Mix and Match mode and has a manipulator, update the manipulator motors
            if (robotHasManipulator == 1 && isMixAndMatch == 1)
            {
                Debug.Log("Manipulator should be moving");
                DriveJoints.UpdateManipulatorMotors(manipulatorNode, emptyDIO, controlIndex, MixAndMatchMode.GetMecanum());
            }
        }

        if (IsResetting)
        {
            Resetting();
        }

        UpdateStats();
    }
Esempio n. 3
0
        /// <summary>
        /// Updates the motors of the robot.
        /// </summary>
        protected override void UpdateMotors(float[] pwm = null)
        {
            base.UpdateMotors(pwm);

            if (RobotHasManipulator)
            {
                DriveJoints.UpdateManipulatorMotors(manipulatorNode, emptyDIO, ControlIndex);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Updates the motors of the robot.
        /// </summary>
        protected override void UpdateMotors()
        {
            base.UpdateMotors();

            if (RobotHasManipulator)
            {
                DriveJoints.UpdateManipulatorMotors(manipulatorNode, ControlIndex, emuList);
            }
        }