private void RobotThread_OnDisconnecting(Robot.Hardware.Robot sender)
        {
            if ((sender != null) && (sender is ROV rov))
            {
                rov.FrontLeftThruster.Stop();
                rov.FrontLeftThruster.Enabled = false;

                rov.FrontRightThruster.Stop();
                rov.FrontRightThruster.Enabled = false;

                rov.BackLeftThruster.Stop();
                rov.BackLeftThruster.Enabled = false;

                rov.BackRightThruster.Stop();
                rov.BackRightThruster.Enabled = false;
            }
        }
        private void RobotThread_OnConnected(Robot.Hardware.Robot sender)
        {
            if ((sender != null) && (sender is ROV rov))
            {
                //rov.TwiSettings.Frequency = 400000;

                rov.FrontLeftServo.Enabled  = true;
                rov.FrontRightServo.Enabled = true;
                rov.BackLeftServo.Enabled   = true;
                rov.BackRightServo.Enabled  = true;

                rov.FrontLeftThruster.Enabled  = true;
                rov.FrontRightThruster.Enabled = true;
                rov.BackLeftThruster.Enabled   = true;
                rov.BackRightThruster.Enabled  = true;

                rov.LeftGripperServo.Enabled  = true;
                rov.RightGripperServo.Enabled = true;
                rov.NetServo.Enabled          = true;
            }
        }
Exemplo n.º 3
0
        private void Robot_OnConnected(Robot.Hardware.Robot sender)
        {
            if ((sender != null) && (sender is ROV rov))
            {
                foreach (KeyValuePair <string, Servo> pair in rov.Servos)
                {
                    Servo servo = pair.Value;
                    if (ServoRanges.ContainsKey(pair.Key))
                    {
                        servo.PWM.PulseRange = ServoRanges[pair.Key];
                    }
                }

                foreach (KeyValuePair <string, Thruster> pair in rov.Thrusters)
                {
                    Thruster thruster = pair.Value;
                    if (ThrusterRanges.ContainsKey(pair.Key))
                    {
                        thruster.PulseRange = ThrusterRanges[pair.Key];
                    }
                }
            }
        }