You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Actuators and Sensors are currently treated independently. The move away from global arrays makes it easier to modularize each device into a separate file. However it makes things slightly confusing if controlling one device depends on readings from another. Eg: PID control of pressure regulator using pressure sensor.
Suggest that if an actuator needs to query a sensor, a function is implemented for that sensor which will return the last read value. Then that function can be made extern and the header file for the sensor included in the relevant actuator files. The "last read value" could be stored as a static variable in the sensor code.
This approach avoids the need to add global variables and keeps the thread related code separate from hardware control.
Of course if actuators don't need to query sensors then there is no point worrying about this any further.
The text was updated successfully, but these errors were encountered:
Actuators and Sensors are currently treated independently. The move away from global arrays makes it easier to modularize each device into a separate file. However it makes things slightly confusing if controlling one device depends on readings from another. Eg: PID control of pressure regulator using pressure sensor.
Suggest that if an actuator needs to query a sensor, a function is implemented for that sensor which will return the last read value. Then that function can be made extern and the header file for the sensor included in the relevant actuator files. The "last read value" could be stored as a static variable in the sensor code.
This approach avoids the need to add global variables and keeps the thread related code separate from hardware control.
Of course if actuators don't need to query sensors then there is no point worrying about this any further.
The text was updated successfully, but these errors were encountered: