Klamp't  0.8.1
SerialControlledRobot.h
1 #ifndef SERIAL_CONTROLLED_ROBOT_H
2 #define SERIAL_CONTROLLED_ROBOT_H
3 
4 #include "ControlledRobot.h"
5 #include <KrisLibrary/utils/AsyncIO.h>
6 
15 {
16  public:
17  SerialControlledRobot(const char* host,double timeout=Inf);
18  virtual ~SerialControlledRobot();
20  virtual bool Init(Robot* robot,RobotController* controller);
22  bool Process(double timeout);
25  bool Run();
27  void Stop();
28  //for multi-threaded applications -- this mutex locks access to the command / sensors / klamptController structures
29  void SetMutex(Mutex* controllerMutex);
30  virtual void ReadSensorData(RobotSensors& sensors);
31  virtual void WriteCommandData(const RobotMotorCommand& command);
32 
33  string host;
34  shared_ptr<SocketPipeWorker> controllerPipe;
35  Real robotTime;
36  Real timeStep;
37  int numOverruns;
38  bool stopFlag;
39  Mutex* controllerMutex;
40 };
41 
42 #endif
void Stop()
Called by an external thread to stop the Run() loop.
The main robot type used in RobotSim.
Definition: Robot.h:79
A collection of basic motor types.
Definition: Command.h:43
bool Process(double timeout)
Call to process a single message.
An interface for a Klamp&#39;t controlled robot. This should be implemented if you wish to use Klamp&#39;t co...
Definition: ControlledRobot.h:19
virtual bool Init(Robot *robot, RobotController *controller)
call this first before calling Run
A set of sensors for the robot.
Definition: Sensor.h:106
A Klamp&#39;t controlled robot that communicates to a robot (either real or virtual) using the Klamp&#39;t co...
Definition: SerialControlledRobot.h:14
A base class for a robot controller. The base class does nothing.
Definition: Controller.h:27