Klamp't
0.9.0
|
A controller that writes sensor data to a socket and reads robot commands from a socket. More...
#include <SerialController.h>
Public Member Functions | |
SerialController (RobotModel &robot, const string &servAddr="", Real writeRate=10) | |
virtual const char * | Type () const |
virtual void | Update (Real dt) |
virtual void | Reset () |
virtual map< string, string > | Settings () const |
virtual bool | GetSetting (const string &name, string &str) const |
virtual bool | SetSetting (const string &name, const string &str) |
bool | OpenConnection (const string &servaddr) |
bool | CloseConnection () |
void | PackSensorData (AnyCollection &data) |
Public Member Functions inherited from Klampt::RobotController | |
RobotController (RobotModel &robot) | |
virtual bool | ReadState (File &f) |
virtual bool | WriteState (File &f) const |
virtual vector< string > | Commands () const |
virtual bool | SendCommand (const string &name, const string &str) |
void | SetPIDCommand (const Config &qdes) |
void | SetPIDCommand (const Config &qdes, const Config &dqdes) |
void | SetFeedforwardPIDCommand (const Config &qdes, const Config &dqdes, const Vector &torques) |
void | SetTorqueCommand (const Vector &torques) |
bool | GetCommandedConfig (Config &q) |
bool | GetCommandedVelocity (Config &dq) |
bool | GetSensedConfig (Config &q) |
bool | GetSensedVelocity (Config &dq) |
Public Attributes | |
string | servAddr |
Real | writeRate |
Real | lastWriteTime |
shared_ptr< SocketPipeWorker > | controllerPipe |
Config | vcmd |
Real | endVCmdTime |
Public Attributes inherited from Klampt::RobotController | |
RobotModel & | robot |
Real | time |
Real | nominalTimeStep |
a "desired" time step, by default 0, which acts as a hint to the simulator. Note that it doesn't have to abide the hint. | |
RobotSensors * | sensors |
sensor input (filled in by simulator) | |
RobotMotorCommand * | command |
motor command output (output to simulator) | |
A controller that writes sensor data to a socket and reads robot commands from a socket.
Sensor data is given by string messages, formatted in JSON, prepended by 4 bytes of the string length. Messages are of the form: "{sensor1:[values1[0],...,values1[n1]],...,sensork:[valuesk[0],...valuesk[0]]}"
Command data is formatted the same way in JSON, prepended by 4 bytes of the string length. The commands are of the form: {command1:value1,...commandk:valuek} where command can be
Command data is read opportunistically. Sensor data is written at a given writeRate (in Hz)
Settings include