FIRST Robotics Competition Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Using sensor data across different subsytems

I am curious what best practices are here for the C & C framework.  It would seem a little strange for me to Open a second instance of the sensor in the second controller VI but maybe that would work.  

 

Or maybe if you setup commands within the primary subsystem (e.g. Drive) you could call those commands within the second controller VI.  It seems like that would work and maybe be a better way but probably means writing more commands in the first controller.  

 

 

 

 

0 Kudos
Message 1 of 2
(2,406 Views)

It's a bit difficult to answer something as hypothetical as this.  Can you give the situation you're running into so I can take a look and explain how I'd go about it?

 

There are a variety of ways to get into this.  One way is to create a subsystem to control that sensor.  Although the templates create a refnum for motors, I teach my students to delete that immediately.  In C&C, the controller should be the only one accessing that reference.  If a sensor can/should be used across a variety of subsystems, it makes sense to give it a controller of its own. 

 

If it's something that predominantly belongs to a single subsystem, add it there.  And yes, you can make more commands to be used elsewhere.

 

I would not open a second instance of the sensor.  There should only be one open and one close for it.

0 Kudos
Message 2 of 2
(2,393 Views)