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

SimTest program. More...

#include <SimTestGUI.h>

Inheritance diagram for SimTestBackend:
SimGUIBackend WorldGUIBackend GLNavigationBackend MouseDragBackend GenericBackendBase

Public Types

enum  { ModeNormal, ModeForceApplication }
typedef SimGUIBackend BaseT
- Public Types inherited from SimGUIBackend
typedef GLNavigationBackend BaseT
- Public Types inherited from GLNavigationBackend
typedef MouseDragBackend BaseT

Public Member Functions

 SimTestBackend (RobotWorld *world)
virtual void Start ()
 Default implementation of following do nothing.
virtual bool OnCommand (const string &cmd, const string &args)
virtual bool OnIdle ()
void ToggleSensorPlot (int sensorIndex, int enabled)
void ToggleSensorMeasurement (int sensorIndex, int measurement, int enabled)
void ToggleDrawExpandedCheckbox (int checked)
void SimStep (Real dt)
void SensorPlotUpdate ()
bool LoadFile (const char *fn)
virtual void RenderWorld ()
 Renders the state of the simulation.
virtual void RenderScreen ()
virtual void DoPassiveMouseMove (int x, int y)
 Overload this to handle plain, non-dragging mouse motion events.
virtual void BeginDrag (int x, int y, int button, int modifiers)
virtual void EndDrag (int x, int y, int button, int modifiers)
virtual void DoFreeDrag (int dx, int dy, int button)
 Overload this for regular (non-modified) dragging.
virtual void DoCtrlDrag (int dx, int dy, int button)
 Overload this for control-dragging.
virtual void DoAltDrag (int dx, int dy, int button)
 Overload this for alt-dragging.
virtual void DoShiftDrag (int dx, int dy, int button)
 Overload this for shift-dragging.
- Public Member Functions inherited from SimGUIBackend
 SimGUIBackend (RobotWorld *world)
bool LoadAndInitSim (const char *xmlFile)
 Loads from a world XML file.
bool LoadAndInitSim (int argc, const char **argv)
 Loads from a command line.
bool LoadFile (const char *fn)
 Loads some file, figuring out the type from the extension.
bool LoadPath (const char *fn)
 Loads some file, figuring out the type from the extension.
virtual void InitSim ()
 Initializes simulation default controllers, sensors, and contact feedback.
virtual void InitController (int robot)
 Initializes default controllers and sensors for the indicated robot.
virtual void InitContactFeedbackAll ()
 Initializes all contact feedback.
void ConnectSerialController (int robot, int port=3456, Real writeRate=10)
 Connects a robot to a SerialController listening for new connections on the given port.
void ResetSim ()
 Returns the simulation to its initial state.
void SetForceColors ()
 Sets the colors of robots to indicate force magnitudes.
void SetTorqueColors ()
 Sets the colors of robots to indicate torque magnitudes.
void DrawClock (int x, int y)
 Renders the simulation clock (when in screen mode)
void DrawSensor (int robot=-1, int sensor=-1)
void DrawContacts (Real pointSize=5.0, Real fscale=0.01, Real nscale=0.05)
 Draws contact points.
void DrawWrenches (Real fscale=-1)
 Draws wrenches.
bool LoadMilestones (const char *fn)
 Loads and sends a milestone path file.
bool LoadLinearPath (const char *fn)
 Loads and sends a linear path file.
bool LoadState (const char *fn)
 Loads a simulation state file.
bool LoadMultiPath (const char *fn, bool constrainedInterpolate=true, Real interpolateTolerance=1e-2, Real durationScale=1.0)
 Loads a multipath file and possibly discretizes it into a fine-grained linear path before sending.
bool SendLinearPath (const vector< Real > &times, const vector< Config > &milestones, Real pathDelay=0.1)
bool OutputROS (const char *prefix="klampt")
 Outputs simulation data to ROS with the given prefix.
void DoLogging (const char *fn="simtest_log.csv")
 Logs the state of all objects in the world to the given CSV file.
void DoCommandLogging_LinearPath (int robot, const char *fn="simtest_command_log.path")
 Logs the robot's commands to the given linear path file.
void DoSensorLogging_LinearPath (int robot, const char *fn="simtest_sensed_log.path")
 Logs the robot's sensed configuration to the given linear path file.
void DoStateLogging_LinearPath (int robot, const char *fn="simtest_state_log.path")
 Logs the robot's simulation state to the given linear path file.
void DoContactStateLogging (const char *fn="simtest_contact_log.csv")
 Logs contact changes to the given CSV file.
void DoContactWrenchLogging (const char *fn="simtest_wrench_log.csv")
 Logs contact wrenches to the given CSV file.
- Public Member Functions inherited from WorldGUIBackend
 WorldGUIBackend (RobotWorld *world)
bool LoadCommandLine (int argc, const char **argv)
bool LoadFile (const char *fn)
bool ReloadFile (const char *fn)
bool SaveWorld (const char *fn, const char *elementPath=NULL)
virtual void SetWorldLights ()
RobotClickRobot (int x, int y, int &body, Vector3 &localpt) const
RobotClickRobot (const Ray3D &r, int &body, Vector3 &localpt) const
RigidObjectClickObject (int x, int y, Vector3 &localpt) const
RigidObjectClickObject (const Ray3D &r, Vector3 &localpt) const
virtual void RefreshIdle ()
virtual bool OnMouseWheel (int dwheel)
- Public Member Functions inherited from GLNavigationBackend
virtual bool OnGLRender ()
virtual bool OnGLViewport (int x, int y, int w, int h)
void DragPan (int dx, int dy)
void DragRotate (int dx, int dy)
void DragZoom (int dx, int dy)
void DragTruck (int dx, int dy)
void Set2DMode (bool mode=true)
void DisplayCameraTarget ()
void CenterCameraOn (const Math3D::AABB3D &bbox)
void ClickRay (int x, int y, Math3D::Vector3 &src, Math3D::Vector3 &dir) const
void WriteDisplaySettings (std::ostream &out) const
void ReadDisplaySettings (std::istream &in)
- Public Member Functions inherited from MouseDragBackend
virtual bool OnMouseClick (int button, int state, int mx, int my)
virtual bool OnMouseMove (int mx, int my)
virtual bool OnKeyDown (const string &key)
virtual bool OnKeyUp (const string &key)
virtual void DoDrag (int dx, int dy, int button, int modifiers)
- Public Member Functions inherited from GenericBackendBase
virtual void Stop ()
virtual bool ProcessMessage (const AnyCollection &msg)
virtual bool SendMessage (const AnyCollection &msg)
 Send a message to the gui.
void MapButtonPress (const string &button, int *var)
void MapButtonToggle (const string &button, int *var)
void MapWidgetValue (const string &button, string *var)
void MapKeyToggle (const string &key, int *var)
virtual bool OnButtonPress (const string &button)
virtual bool OnButtonToggle (const string &button, int checked)
virtual bool OnWidgetValue (const string &widget, const string &value)
virtual bool OnScroll (int dy)
virtual bool OnSpaceball (const Math3D::RigidTransform &T)
virtual bool OnDevice (const string &name, const string &data)
bool SendQuit ()
bool SendCommand (const string &cmd, const string &args)
bool SendNotify (const string &text, const string &msglevel="")
bool SendError (const string &text)
bool SendWarning (const string &text)
bool SendPauseIdle (double secs=1e300)
bool SendRefresh ()
bool SendResize (int w, int h)
bool SendDrawText (double x, double y, double z, const std::string &text, int height=10)
bool SendDrawText (int x, int y, const std::string &text, int height=10)

Public Attributes

AppUtils::ProgramSettings settings
int cur_link
int cur_driver
int pose_objects
int output_ros
int click_mode
vector< RobotPoseWidgetrobotWidgets
vector< RigidObjectPoseWidgetobjectWidgets
WidgetSet allRobotWidgets
WidgetSet allObjectWidgets
WorldDragWidget dragWidget
WidgetSet allWidgets
int forceSpringActive
Vector3 forceSpringAnchor
int drawBBs
int drawPoser
int drawDesired
int drawEstimated
int drawContacts
int drawWrenches
int drawExpanded
int drawTime
int doLogging
string simLogFile
string contactStateLogFile
string contactWrenchLogFile
map< int, string > robotCommandLogFiles
map< int, string > robotSensedLogFiles
map< int, string > robotTorqueLogFiles
vector< SensorPlotsensorPlots
vector< vector< bool > > drawSensors
vector< GeometryAppearance > originalAppearance
vector< GeometryAppearance > expandedAppearance
- Public Attributes inherited from SimGUIBackend
int simulate
WorldSimulation sim
string initialState
set< pair< int, int > > inContact
 the contact state on the last DoContactStateLogging call
- Public Attributes inherited from WorldGUIBackend
- Public Attributes inherited from GLNavigationBackend
Camera::Viewport viewport
Camera::CameraController_Orbit camera
bool stereo_mode
float stereo_offset
Timer timer
int show_view_target
float t_hide_view_target
float frames_per_second
bool show_frames_per_second
int frames_rendered
bool mode_2d
- Public Attributes inherited from MouseDragBackend
int oldmousex
int oldmousey
int clickButton
int clickModifiers
- Public Attributes inherited from GenericBackendBase
map< string, int * > liveButtonPresses
map< string, int * > liveButtonToggles
map< string, string * > liveWidgetValues
map< string, int * > liveKeys

Detailed Description

SimTest program.

Messages are defined as follows.



Signals sent back to GUI are defined as follows:

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