How do I listen for an action in the program?

In the I/O Setup installation node, you can configure the robot to send a HI/LO signal on certain actions, such as when the program is not running:

I would like to make a URCap that runs certain logic when the program is not running. Is there any way to register an even listener for an “action in program” ?

Sounds like you’re asking 2 separate questions.

  1. Run URCAP logic while a program is not running
  2. Register an event listener.

What exactly are you trying to capture when you say “action in program”?

As far as I know, the only chance you have for running background logic without a program running is to use a python daemon, or else maybe running a Thread in Java to monitor for things like physical input changes.

Hi Eric,

When I say “action in program” I am referencing the combo box in PolyScope, which in my screenshot has “High when running-low stopped” selected. This combo box allows you to set digital outputs to HI or LO depending on the state of the robot or program.

What I am trying to achieve is a loop or task that runs at a fixed rate whenever there is no running program on the robot. If there is a way to listen for events such as ProgramStart and ProgramStop, then I was hoping to use something like ScheduledExecutorService#scheduleAtFixedRate(Runnable, long, long, TimeUnit) and Future#cancel(boolean) to run this repeating logic as necessary.

Hopefully that makes sense!

I think I would probably connect to the dashboard server and leave that running constantly (start it in the Activator maybe) and when it detects that the program state is “Not Running” then fire your other thread. The Dashboard server is the only thing I’m aware of that can monitor the state of the program.