Open brettle opened 1 month ago
Given that we've already merged DeepBlueRobotics/DeepBlueSim#67, would it make more sense to just have any sim interface work over the existing NT API? We could add helper classes that set the specific NT values, exposing get/setTx/Ty()
, but I don't really think that's necessary either, as they would basically just be one-liners/boilerplate.
I'm fine with not using the SimDevice
/SimDeviceSim
infrastructure here, but would still like to see a LimelightSim
class that encapsulates getting/setting the relevant NT values. It would be the simulator-facing analog of the robot-facing LimeLightHelpers
provided by the vendor. While most of the code would be one-liners/boilerplate, it would enable better compile time checking (because callers wouldn't be at risk of misspelling the names of the NT keys) and would make it easier to keep existing code working if the vendor's NT interface changes or is replaced. All that said, I agree such work is low priority.
Actually, one downside to using NT is that if the developer is on the robot network (which also contains the limelight) when they try to run a simulation, the simulated and real limelights will be fighting over the same keys unless other measures are taken. Might want to still have something like SensorFactory.createLimelight()
that returns a different implementation during simulation, perhaps just one that uses a different NT table.
- [ ] AddSensorFactory.createLimelight()
to return aLimelight
while also providing creating an appropriateSimDevice
for it either via subclassing or using Mockito. TheSimDevice
would includekInput
values for things liketx
,ty
, etc.LimelightSim
class towrap theprovide methods such asSimDeviceSim
object corresponding to theSimDevice
created above. TheLimelightSim
object provides the API to simulation code and shouldsetTx()
,setTy()
, etc.