Esempio n. 1
0
 protected void OnDriveOutput(DriveOutputState output)
 {
     if (DriveOutput != null)
     {
         DriveOutput(output);
     }
 }
Esempio n. 2
0
 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);
     }
 }
Esempio n. 3
0
 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);
     }
 }
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
        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);
            }
        }
Esempio n. 6
0
 protected void OnDriveOutput(DriveOutputState output)
 {
     if (DriveOutput != null)
     {
         DriveOutput(output);
     }
 }