I’m mentoring a team using the Romi robot platform this year (via the WPILib halsim_ws_client and halsim_ds_socket extensions), and noticed something interesting.
It appears edu.wpi.first.wpilibj.RobotBase.isReal() always reports false, whether we have a real robot connected via websockets. This seems surprising, but may be technically correct (the best kind of correct!)… I think it may be the case that the Romi is always technically “simulated,” in the sense that the code is running on the desktop PC, not inside the Romi itself.
That is because when you are using websockets, you are actually using the simulator and not a real ROBOT as WPILib looks at it. It would be nice though if there were a way to distinguish between the two, but I am not sure that is plausible at the moment.
That’s correct. We don’t have a way to distinguish between plain simulation and Romi-connected simulation right now. We could expose a way to set this via WebSockets so the Romi could change it, but we don’t have that ability right now.
That should be no problem; in our case, I think the team can hack a solution by just setting one of the configurable DIO pins as a digital input and bridging it to register always closed. That ought to give us a distinguishable “Am I a real machine” signal.