Skip to content

environmentSimulator Implementation #5

@atmask

Description

@atmask

#envSim Details

  • Receives all pipe write FD from command line args

Thread A

  • name_attach /dev/local/environment
  • while loop: receiving actuator pulses and updating the stored state of that actuator in the process
  • data receive in the form TEMP;UP or TEMP;DOWN or TEMP;OFF. TEMP and associated states UP DOWN OFF are defined in constants.h
  • accessing the state of an actuator should be mutexed

Thread B

  • Get mutex and check the actuator state
  • if actuator OFF (OFF is defined in constants.h) then modify temp as temp+=randomNum(-1, 1) and push to correct pipe
  • if actuator UP (UP is defined in constants.h) then modify temp as temp+=randomNum(0.5, 1)
  • if actuator DOWN (DOWN is defined in constants.h) then modify temp as temp+=randomNum(-0.5, -1)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions