Cheetah Software  1.0
SimulatorSyncronizedMessage Struct Reference

#include <SimulatorMessage.h>

+ Inheritance diagram for SimulatorSyncronizedMessage:
+ Collaboration diagram for SimulatorSyncronizedMessage:

Public Member Functions

void init ()
 
void waitForSimulator ()
 
void simulatorIsDone ()
 
void waitForRobot ()
 
bool tryWaitForRobot ()
 
bool waitForRobotWithTimeout ()
 
void robotIsDone ()
 

Private Attributes

SharedMemorySemaphore robotToSimSemaphore
 
SharedMemorySemaphore simToRobotSemaphore
 

Additional Inherited Members

- Public Attributes inherited from SimulatorMessage
RobotToSimulatorMessage robotToSim
 
SimulatorToRobotMessage simToRobot
 

Detailed Description

A SimulatorSyncronizedMessage is stored in shared memory and is accessed by both the simulator and the robot The simulator and robot take turns have exclusive access to the entire message. The intended sequence is:

  • robot: waitForSimulator()
  • simulator: simulates robot (simulator can read/write, robot cannot do anything)
  • simulator: simDone()
  • simulator: waitForRobot()
  • robot: runs controller (robot can read/write, simulator cannot do anything)
  • robot: robotDone();
  • robot: waitForSimulator() ...

Definition at line 87 of file SimulatorMessage.h.

Member Function Documentation

void SimulatorSyncronizedMessage::init ( )
inline

The init() method should only be called after shared memory is connected!

Definition at line 91 of file SimulatorMessage.h.

91  {
94  }
void init(unsigned int value)
Definition: SharedMemory.h:39
SharedMemorySemaphore simToRobotSemaphore
SharedMemorySemaphore robotToSimSemaphore
void SimulatorSyncronizedMessage::robotIsDone ( )
inline

Definition at line 108 of file SimulatorMessage.h.

void SimulatorSyncronizedMessage::simulatorIsDone ( )
inline

Definition at line 98 of file SimulatorMessage.h.

bool SimulatorSyncronizedMessage::tryWaitForRobot ( )
inline

Definition at line 102 of file SimulatorMessage.h.

102 { return robotToSimSemaphore.tryDecrement(); }
SharedMemorySemaphore robotToSimSemaphore
void SimulatorSyncronizedMessage::waitForRobot ( )
inline

Definition at line 100 of file SimulatorMessage.h.

bool SimulatorSyncronizedMessage::waitForRobotWithTimeout ( )
inline

Definition at line 104 of file SimulatorMessage.h.

104  {
106  }
SharedMemorySemaphore robotToSimSemaphore
bool decrementTimeout(u64 seconds, u64 nanoseconds)
Definition: SharedMemory.h:72
void SimulatorSyncronizedMessage::waitForSimulator ( )
inline

Definition at line 96 of file SimulatorMessage.h.

Member Data Documentation

SharedMemorySemaphore SimulatorSyncronizedMessage::robotToSimSemaphore
private

Definition at line 111 of file SimulatorMessage.h.

SharedMemorySemaphore SimulatorSyncronizedMessage::simToRobotSemaphore
private

Definition at line 111 of file SimulatorMessage.h.


The documentation for this struct was generated from the following file: