Marco Oehler / Mbed 2 deprecated Lab2

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

StateMachine Class Reference

StateMachine Class Reference

This class implements a simple state machine for a mobile robot. More...

#include <StateMachine.h>

Public Member Functions

 StateMachine (Controller &controller, DigitalOut &enableMotorDriver, DigitalOut &led0, DigitalOut &led1, DigitalOut &led2, DigitalOut &led3, DigitalOut &led4, DigitalOut &led5, DigitalIn &button, IRSensor &irSensor0, IRSensor &irSensor1, IRSensor &irSensor2, IRSensor &irSensor3, IRSensor &irSensor4, IRSensor &irSensor5)
 Creates and initializes a state machine object.
virtual ~StateMachine ()
 Deletes the state machine object and releases all allocated resources.
int getState ()
 Gets the actual state of this state machine.

Detailed Description

This class implements a simple state machine for a mobile robot.

It allows to move the robot forward, and to turn left or right, depending on distance measurements, to avoid collisions with obstacles.

Definition at line 21 of file StateMachine.h.


Constructor & Destructor Documentation

StateMachine ( Controller controller,
DigitalOut &  enableMotorDriver,
DigitalOut &  led0,
DigitalOut &  led1,
DigitalOut &  led2,
DigitalOut &  led3,
DigitalOut &  led4,
DigitalOut &  led5,
DigitalIn &  button,
IRSensor irSensor0,
IRSensor irSensor1,
IRSensor irSensor2,
IRSensor irSensor3,
IRSensor irSensor4,
IRSensor irSensor5 
)

Creates and initializes a state machine object.

Definition at line 20 of file StateMachine.cpp.

~StateMachine (  ) [virtual]

Deletes the state machine object and releases all allocated resources.

Definition at line 33 of file StateMachine.cpp.


Member Function Documentation

int getState (  )

Gets the actual state of this state machine.

Returns:
the actual state as an int constant.

Definition at line 42 of file StateMachine.cpp.