コード例 #1
0
        /// <summary>
        /// Sets the forward velocity of the drive.
        /// </summary>
        /// <param name="speed">velocity in mm/s</param>
        /// <returns>response port</returns>
        private PortSet <DefaultUpdateResponseType, Fault> MoveForward(int speed)
        {
            LogInfo(string.Format("MoveForward speed={0}", speed));
            if ((_state.DriveState == null || !_state.DriveState.IsEnabled) && speed != 0)
            {
                EnableMotor();
            }

            drive.SetDriveSpeedRequest request = new drive.SetDriveSpeedRequest();

            request.LeftWheelSpeed  = (double)speed / 1000.0; // millimeters to meters
            request.RightWheelSpeed = (double)speed / 1000.0; // millimeters to meters

            return(_drivePort.SetDriveSpeed(request));
        }