SCL  1.0
Standard Control Library : Control, dynamics, physics, and simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
Classes | Public Member Functions | Public Attributes | List of all members
scl::CRobotApp Class Referenceabstract

#include <CRobotApp.hpp>

Collaboration diagram for scl::CRobotApp:
Collaboration graph
[legend]

Classes

class  SUiCtrlPointData
 

Public Member Functions

virtual void stepMySimulation ()=0
 
virtual scl::sBool initMyController (const std::vector< std::string > &argv, sUInt args_already_parsed)=0
 
virtual scl::sBool registerCustomDynamicTypes ()
 
virtual scl::sBool setInitialStateForUIAndDynamics ()=0
 
 CRobotApp ()
 
virtual ~CRobotApp ()
 
scl::sBool init (const std::vector< std::string > &argv)
 
virtual void terminate ()
 
void runMainLoopThreaded (const int &thread_id)
 
void runMainLoop ()
 
void runConsoleShell ()
 

Public Attributes

scl::SDatabasedb_
 
std::vector< std::string > robots_parsed_
 
std::string robot_name_
 
std::string ctrl_name_
 
scl::CRobot robot_
 
scl::SRobotParsedrob_ds_
 
scl::SRobotIOrob_io_ds_
 
scl::CDynamicsTaodyn_tao_
 
scl::CDynamicsScldyn_scl_
 
scl::sLongLong ctrl_ctr_
 
scl::sFloat t_start_
 
scl::sFloat t_end_
 
std::vector< SUiCtrlPointDatataskvec_ui_ctrl_point_
 

Detailed Description

Generic code to run a scl simulation.

A simulation requires running 3 things. This example uses:

  1. A dynamics/physics engine : Tao
  2. A controller : Wbc
  3. A graphic rendering+interaction interface : Chai3d + FreeGlut

It allows a single threaded mode (good for debugging) and a multi-threaded mode (good for optimized binaries).

NOTE : You DO NOT have to use this class. As with everything else in scl/robot, this class is merely a set of helper functions that wrap around the core controller, dynamics and rendering. It is meant to simplify your programs so feel free to build your own API if this doesn't suit you...

Constructor & Destructor Documentation

scl::CRobotApp::CRobotApp ( )

Default constructor. Sets stuff to zero.

virtual scl::CRobotApp::~CRobotApp ( )
inlinevirtual

Default destructor. Does nothing

Member Function Documentation

scl::sBool scl::CRobotApp::init ( const std::vector< std::string > &  argv)

Initialize the basic global variables, database etc.

Test whether Controller is a task controller. If so, parse task options.

virtual scl::sBool scl::CRobotApp::initMyController ( const std::vector< std::string > &  argv,
sUInt  args_already_parsed 
)
pure virtual

Implement this function.

NOTE : The init() function initializes most things for you and then automatically calls this function.

Parameters
args_already_parsedThe CRobotApp's init function already parses some command line arguments. This counter tells your controller implementation what is already parsed. The implementation assumes that this function will parse the remaining args.
virtual scl::sBool scl::CRobotApp::registerCustomDynamicTypes ( )
inlinevirtual

Register any custom dynamic types that you have.

void scl::CRobotApp::runConsoleShell ( )

Runs a console shell that enables you to modify the app through your commands (provided you've registered them with the callback registry.

NOTE : The console runs in two modes:

Mode 1 : String lookup: function name = string arguments = vector<string>

Mode 2 : Char lookup: function name = char is_caps? = bool

Default starts in string lookup. Press 'x' to switch between modes.

(See the callback registry sutil/CCallbackRegistry.hpp for more details)

void scl::CRobotApp::runMainLoop ( )

Runs a simulation using one thread. 1: Computes the robot dynamics 2: Renders the graphics and handles gui interaction

void scl::CRobotApp::runMainLoopThreaded ( const int &  thread_id)

Runs a simulation using two threads: Thread 1: Computes the robot dynamics Thread 2: Renders the graphics and handles gui interaction

virtual scl::sBool scl::CRobotApp::setInitialStateForUIAndDynamics ( )
pure virtual

Sets any vars to their initial position and run the dynamics once to flush the state.

virtual void scl::CRobotApp::stepMySimulation ( )
pure virtual

Implement this function.

void scl::CRobotApp::terminate ( )
virtual

Terminates the simulation and prints some statistics

Member Data Documentation

std::vector<SUiCtrlPointData> scl::CRobotApp::taskvec_ui_ctrl_point_

The operational points that will be linked to keyboard handlers. NOTE : This is presently designed for a task controller's xyz ctrl tasks


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