SCL
1.0
Standard Control Library : Control, dynamics, physics, and simulation
|
#include <CRobotApp.hpp>
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::SDatabase * | db_ |
std::vector< std::string > | robots_parsed_ |
std::string | robot_name_ |
std::string | ctrl_name_ |
scl::CRobot | robot_ |
scl::SRobotParsed * | rob_ds_ |
scl::SRobotIO * | rob_io_ds_ |
scl::CDynamicsTao * | dyn_tao_ |
scl::CDynamicsScl * | dyn_scl_ |
scl::sLongLong | ctrl_ctr_ |
scl::sFloat | t_start_ |
scl::sFloat | t_end_ |
std::vector< SUiCtrlPointData > | taskvec_ui_ctrl_point_ |
Generic code to run a scl simulation.
A simulation requires running 3 things. This example uses:
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...
scl::CRobotApp::CRobotApp | ( | ) |
Default constructor. Sets stuff to zero.
|
inlinevirtual |
Default destructor. Does nothing
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.
|
pure virtual |
Implement this function.
NOTE : The init() function initializes most things for you and then automatically calls this function.
args_already_parsed | The 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. |
|
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
|
pure virtual |
Sets any vars to their initial position and run the dynamics once to flush the state.
|
pure virtual |
Implement this function.
|
virtual |
Terminates the simulation and prints some statistics
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