Klamp't  0.9.0
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 
7 namespace Klampt {
8 
17 {
18  public:
19  SerialControlledRobot(const char* host,double timeout=Inf);
20  virtual ~SerialControlledRobot();
22  virtual bool Init(RobotModel* robot,RobotController* controller);
24  bool Process(double timeout);
27  bool Run();
29  void Stop();
30  //for multi-threaded applications -- this mutex locks access to the command / sensors / klamptController structures
31  void SetMutex(Mutex* controllerMutex);
32  virtual void ReadSensorData(RobotSensors& sensors);
33  virtual void WriteCommandData(const RobotMotorCommand& command);
34 
35  string host;
36  shared_ptr<SocketPipeWorker> controllerPipe;
37  Real robotTime;
38  Real timeStep;
39  int numOverruns;
40  bool stopFlag;
41  Mutex* controllerMutex;
42 };
43 
44 } //namespace Klampt
45 
46 #endif
A set of sensors for the robot.
Definition: Sensor.h:111
virtual bool Init(RobotModel *robot, RobotController *controller)
call this first before calling Run
A collection of basic motor types.
Definition: Command.h:45
void Stop()
Called by an external thread to stop the Run() loop.
A base class for a robot controller. The base class does nothing.
Definition: Controller.h:29
A Klamp&#39;t controlled robot that communicates to a robot (either real or virtual) using the Klamp&#39;t co...
Definition: SerialControlledRobot.h:16
bool Process(double timeout)
Call to process a single message.
The main robot type used in RobotSim.
Definition: Robot.h:83
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:21
Definition: ContactDistance.h:6