Klamp't  0.8.1
SerialController.h
1 #ifndef SERIAL_CONTROLLER_H
2 #define SERIAL_CONTROLLER_H
3 
4 #include "Controller.h"
5 #include <KrisLibrary/utils/AsyncIO.h>
6 
7 class AnyCollection;
8 
36 {
37 public:
38  SerialController(Robot& robot,const string& servAddr="",Real writeRate=10);
39  virtual ~SerialController() {}
40  virtual const char* Type() const { return "SerialController"; }
41  virtual void Update(Real dt);
42  virtual void Reset();
43  virtual map<string,string> Settings() const;
44  virtual bool GetSetting(const string& name,string& str) const;
45  virtual bool SetSetting(const string& name,const string& str);
46 
47  bool OpenConnection(const string& servaddr);
48  bool CloseConnection();
49  void PackSensorData(AnyCollection& data);
50 
51  string servAddr;
52  Real writeRate;
53  Real lastWriteTime;
54  shared_ptr<SocketPipeWorker> controllerPipe;
55 
56  //for fixed-velocity commands, these are an accumulator that processes
57  //the linearly increasing configuration
58  Config vcmd;
59  Real endVCmdTime;
60 };
61 
62 
63 
64 #endif
The main robot type used in RobotSim.
Definition: Robot.h:79
A base class for a robot controller. The base class does nothing.
Definition: Controller.h:27
A controller that writes sensor data to a socket and reads robot commands from a socket.
Definition: SerialController.h:35