Klamp't  0.8.1
Public Member Functions | Public Attributes | List of all members
PyController Class Reference

A controller that interfaces with a python module. More...

#include <PyController.h>

Inheritance diagram for PyController:
RobotController

Public Member Functions

 PyController (Robot &robot)
 
bool Load (const string &moduleName)
 
void Unload ()
 
virtual const char * Type () const
 
virtual void Update (Real dt)
 
virtual void Reset ()
 
virtual bool ReadState (File &f)
 
virtual bool WriteState (File &f) const
 
virtual map< string, string > Settings () const
 
virtual bool GetSetting (const string &name, string &str) const
 
virtual bool SetSetting (const string &name, const string &str)
 
virtual vector< string > Commands () const
 
virtual bool SendCommand (const string &name, const string &str)
 
- Public Member Functions inherited from RobotController
 RobotController (Robot &robot)
 
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 moduleName
 
PyObject * module
 
PyObject * updateFunc
 
PyObject * resetFunc
 
PyObject * getStateFunc
 
PyObject * setStateFunc
 
PyObject * getSettingsFunc
 
PyObject * setSettingsFunc
 
vector< string > commandFuncNames
 
vector< PyObject * > commandFuncs
 
- Public Attributes inherited from RobotController
Robotrobot
 
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.
 
RobotSensorssensors
 sensor input (filled in by simulator)
 
RobotMotorCommandcommand
 motor command output (output to simulator)
 

Detailed Description

A controller that interfaces with a python module.

The module is required to define at least the "update" function. This function takes in a dictionary of sensor data and outputs a dictionary of actuator data.

The sensor dictionary includes

The following actuator keys are accepted:

Other functions include


The documentation for this class was generated from the following file: