We are trying to read a sensor that is in a different subsystem and we are having problems, basically, we need the intake to stop once the feeder sensor detects a ball && the intake sensor detects a ball.
Should we have a global variable that is updated when there is a ball in the feeder so we don’t need to require the same subsystem in the parallel command twice? We also found this, but we are not sure what we should do:
Additionally, requirements are enforced within all three types of parallel groups - a parallel group may not contain multiple commands that require the same subsystem.
You can reference a subsystem in a command without requiring it. Just don’t require it in the command that doesn’t physically move that mechanism (although nothing is preventing you from doing that either).
I would think you could also call that method of getting the sensor with a lambda call??? Or use periodic to constantly update a public variable that you access?
This maybe off base but what where I would first try to go myself
Your best option is to setup your commands to take the external data as a Lambda. I go into some detail with a near identical issue in this other thread:
It’s hard to know exactly what you’re trying to do here without knowing what you’re robot design is, but it sounds to me like you want to intake a ball with a command, advance that ball to a location in the robot that the sensor will detect, and then intake a second ball, to a location that a different sensor will detect.
Those are roughly sequential steps as I’m understanding you, so you may relieve yourself of the headache with WaitUntil.