public void Actuate() { var leftWeight = (Math.Abs(currentVelocity.LeftVelocity) - Math.Abs(previousVelocity.LeftVelocity) > 0) ? accelerationWeight : breakingWeight; if (Math.Sign(currentVelocity.LeftVelocity) != Math.Sign(previousVelocity.LeftVelocity)) { leftWeight = breakingWeight; } if (previousVelocity.LeftVelocity == 0) { leftWeight = accelerationWeight; } var rightWeight = (Math.Abs(currentVelocity.RightVelocity) - Math.Abs(previousVelocity.RightVelocity) > 0) ? accelerationWeight : breakingWeight; if (Math.Sign(currentVelocity.RightVelocity) != Math.Sign(previousVelocity.RightVelocity)) { rightWeight = breakingWeight; } if (previousVelocity.RightVelocity == 0) { rightWeight = accelerationWeight; } var left = previousVelocity.LeftVelocity + (leftWeight * (currentVelocity.LeftVelocity - previousVelocity.LeftVelocity)); var right = previousVelocity.RightVelocity + (rightWeight * (currentVelocity.RightVelocity - previousVelocity.RightVelocity)); previousVelocity = new WheelVelocity(left, right); var command = ParseUpdateWheelVelocity(previousVelocity, SetWheelVelocityCode, WheelClicks); manager.CommandAsync(command, 0, this); }
public void GetBumperState() { var command = new byte[1]; command[0] = GetBumperStateCode; manager.CommandAsync(command, 2, this); }
public void GetGroundSensorState() { var command = new byte[1]; command[0] = GetGroundSensorStateCode; manager.CommandAsync(command, 6, this); }
public void GetSonarsBoardState() { var command = new byte[1]; command[0] = GetSonarsStateCode; manager.CommandAsync(command, 10, this); }
public void UpdateOdometryCommand() { var command = new byte[1]; command[0] = GetOdometryCode; manager.CommandAsync(command, 4, this); }
public void Actuate() { var command = new byte[4]; command[0] = GetLedBoardStateCode; command[1] = red; command[2] = green; command[3] = blue; manager.CommandAsync(command, 0, this); }