So, I am looking to extend / adapt the API in my own needs. I am talking about the Lego Mindstorms C # API. I create my own API around it (based on the adapter template), so I can program the robot in the best way OO.
Here's a link on how the API works: Lego Mindstorms EV3 C # API
But now I am stuck very strange that the C # API processes commands for a brick.
Definitely not an OO-way ...
Example: To send a command to a brick, you need to have a brick instance to send the command. But the DirectCommand instance has nothing to do with the brick.
await brick.DirectCommand.TurnMotorAtPowerAsync(OutputPort.A, 50, 5000);
So, I would like to make the brick and DirectCommand loosely coupled.
Here is another example: Execute a command package. You must write out all the commands and then execute a specific method. There is no way in the current API to loop through an array and add their stack element to execute them at a later point.
brick.BatchCommand.TurnMotorAtSpeedForTime(OutputPort.A, 50, 1000, false); brick.BatchCommand.TurnMotorAtPowerForTime(OutputPort.C, 50, 1000, false); brick.BatchCommand.PlayTone(50, 1000, 500); await brick.BatchCommand.SendCommandAsync();
So, I would like to do the following:
Create a command like PlayTone (..) add it to the list of arrays lists and then skip it ...
List<Command> toBeExecuted = new List<Command>; toBeExecuted.Add(DirectCommand.PlayTone(50, 1000, 500)); brick.DirectCommand(toBeExecuted[0]);
So, if someone can help ... I would be very pleased :)