protected void OnDriveOutput(DriveOutputState output) { if (DriveOutput != null) { DriveOutput(output); } }
protected void DriveOutputHandler(DriveOutputState output) { if (output.AllStop) { Arbiter.Activate(TaskQueue, Arbiter.Choice( _drivePort.AllStop(new drive.AllStopRequest()), delegate(DefaultUpdateResponseType success) { }, delegate(W3C.Soap.Fault failure) { LogError("Failed to Stop!"); } ) ); } else { _drivePort.SetDrivePower(output); } }
protected void DriveOutputHandler(DriveOutputState output) { if (output.AllStop) { Arbiter.Activate(TaskQueue, Arbiter.Choice( _drivePort.AllStop(new drive.AllStopRequest()), delegate(DefaultUpdateResponseType success) { }, delegate(W3C.Soap.Fault failure) { LogError("Failed to Stop!"); } ) ); } else { _drivePort.SetDrivePower(output); } }
private void ProcessOutputLink() { // read output link, cache commands int numberOfCommands = _agent.GetNumberCommands(); Identifier command; bool driveOutputReceived = false; DriveOutputState driveOutput = new DriveOutputState(); for (int i = 0; i < numberOfCommands; ++i) { command = _agent.GetCommand(i); String commandName = command.GetAttribute(); switch (commandName) { case "drive-power": String leftPowerString = command.GetParameterValue("left"); if (leftPowerString != null) { driveOutputReceived = true; driveOutput.LeftWheelPower = double.Parse(leftPowerString); } String rightPowerString = command.GetParameterValue("right"); if (rightPowerString != null) { driveOutputReceived = true; driveOutput.RightWheelPower = double.Parse(rightPowerString); } String stopString = command.GetParameterValue("stop"); if (stopString != null) { driveOutputReceived = true; driveOutput.AllStop = bool.Parse(stopString); } if (driveOutputReceived) { command.AddStatusComplete(); } else { OnLog("Soar: Unknown or incomplete drive-power command."); command.AddStatusError(); } break; case "stop-sim": command.AddStatusComplete(); break; default: OnLog("Soar: Unknown command."); command.AddStatusError(); break; } } // This is out here because the commands may be split up between multiple attributes if (driveOutputReceived) { OnDriveOutput(driveOutput); } }
private void ProcessOutputLink() { // read output link, cache commands int numberOfCommands = _agent.GetNumberCommands(); Identifier command; bool driveOutputReceived = false; DriveOutputState driveOutput = new DriveOutputState(); for (int i = 0; i < numberOfCommands; ++i) { command = _agent.GetCommand(i); String commandName = command.GetAttribute(); switch (commandName) { case "drive-power": String leftPowerString = command.GetParameterValue("left"); if (leftPowerString != null) { driveOutputReceived = true; driveOutput.LeftWheelPower = double.Parse(leftPowerString); } String rightPowerString = command.GetParameterValue("right"); if (rightPowerString != null) { driveOutputReceived = true; driveOutput.RightWheelPower = double.Parse(rightPowerString); } String stopString = command.GetParameterValue("stop"); if (stopString != null) { driveOutputReceived = true; driveOutput.AllStop = bool.Parse(stopString); } if (driveOutputReceived) { command.AddStatusComplete(); } else { OnLog("Soar: Unknown or incomplete drive-power command."); command.AddStatusError(); } break; case "stop-sim": command.AddStatusComplete(); break; default: OnLog("Soar: Unknown command."); command.AddStatusError(); break; } } // This is out here because the commands may be split up between multiple attributes if (driveOutputReceived) { OnDriveOutput(driveOutput); } }
protected void OnDriveOutput(DriveOutputState output) { if (DriveOutput != null) { DriveOutput(output); } }