Comet-Robotics / chessBot

♟️ control software for the chess bot project
http://chessbots.cometrobotics.org/
MIT License
6 stars 3 forks source link

[Server]: Change move commands to work with robot ids instead of robots #148

Closed xXDMOGXx closed 6 months ago

xXDMOGXx commented 7 months ago

Task Description:

Currently when a move command is run, it requires a robot. This kinda sucks since to create a fake robot, we need to make up and pass a lot of information to it. Instead of using robots directly, we can use a string id instead, and just request the corresponding robot from the RobotManager. That way, when we test our functions that create commands, we only need to pass a string instead of a whole robot.

Implementation Steps:

  1. In src/server/command/move-command.ts, all the move commands either take, or extend from a class that take a robot. Change this to instead use a string called robotId.
  2. We will be requesting the robot from robot-manager by calling getRobot() and passing the robotId. Any instances where a this.robot.something() is called in .../move-command.ts, change it out by calling RobotManager.getRobot(this.robotId).something() (Make sure to import ../robot/robot-manager)
  3. In src/server/command/command.ts, the RobotCommand class takes in a robot. Change that to also take in our new robotId string instead. Change the this.addRequirements() call in there to use this new robotId as well.
  4. Finally, after importing robot manager, ctrl+f (search) all uses of execute() in .../command.ts and add robot manager as a parameter. Make sure to pass this parameter variable any time a something.execute() is called.

Expected Timeline:

This should be able to be completed in around one ChessBot meeting, or a few days

If you have any questions while working on this task, don't hesitate to do any one of the following:

xXDMOGXx commented 6 months ago

There hasn't been much progress nor any updates on this. I'll go ahead and remove you since this has become a high priority. If it sits unfinished for a couple days, you can request to be added back on