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

#include <CParserBase.hpp>

Inheritance diagram for scl::CParserBase:
Inheritance graph
[legend]

Public Member Functions

 CParserBase ()
 
virtual ~CParserBase ()
 
virtual bool listRobotsInFile (const std::string &arg_file, std::vector< std::string > &arg_robot_names)=0
 
virtual bool readRobotFromFile (const std::string &arg_file, const std::string &arg_robot_name, scl::SRobotParsed &arg_robot)=0
 
virtual bool saveRobotToFile (scl::SRobotParsed &arg_robot, const std::string &arg_file)
 
virtual bool listMuscleSysInFile (const std::string &arg_file, std::vector< std::string > &arg_msys_names)
 
virtual bool readMuscleSysFromFile (const std::string &arg_file, const std::string &arg_msys_name, scl::SActuatorSetMuscleParsed &arg_msys)
 
virtual bool listGraphicsInFile (const std::string &arg_file, std::vector< std::string > &arg_graphics_names)
 
virtual bool readGraphicsFromFile (const std::string &arg_file, const std::string &arg_graphics_name, scl::SGraphicsParsed &arg_graphics)
 
virtual bool listUISpecsInFile (const std::string &arg_file, std::vector< std::string > &arg_ui_spec_names)
 
virtual bool readUISpecFromFile (const std::string &arg_file, const std::string &arg_ui_spec_name, scl::SUIParsed &arg_ui_spec)
 
virtual bool listControllersInFile (const std::string &arg_file, std::vector< std::pair< std::string, std::string > > &arg_ctrl_name_and_type)
 
virtual bool readGcControllerFromFile (const std::string &arg_file, const std::string &arg_ctrl_name, std::string &ret_must_use_robot, scl::SControllerGc &arg_ctrl)
 
virtual bool readTaskControllerFromFile (const std::string &arg_file, const std::string &arg_ctrl_name, std::string &ret_must_use_robot, std::vector< scl::STaskBase * > &ret_taskvec, std::vector< scl::SNonControlTaskBase * > &ret_task_non_ctrl_vec)
 

Detailed Description

This class is a base for reading a robot definition into an SRobotParsed data structure.

All file-format specific parsers will subclass this API class.

Constructor & Destructor Documentation

scl::CParserBase::CParserBase ( )
inline

Default constructor. Does nothing.

virtual scl::CParserBase::~CParserBase ( )
inlinevirtual

Default destructor. Does nothing.

Member Function Documentation

virtual bool scl::CParserBase::listControllersInFile ( const std::string &  arg_file,
std::vector< std::pair< std::string, std::string > > &  arg_ctrl_name_and_type 
)
inlinevirtual

Optional: The subclass may support read out the controller specifications in a file. Each controller is to be stored as a <name, type> pair

Reimplemented in scl::CParserScl.

virtual bool scl::CParserBase::listGraphicsInFile ( const std::string &  arg_file,
std::vector< std::string > &  arg_graphics_names 
)
inlinevirtual

Optional: Returns a list of graphics views in a file. Required : If readGraphicsFromFile() is implemented

Reimplemented in scl::CParserSai, and scl::CParserScl.

virtual bool scl::CParserBase::listMuscleSysInFile ( const std::string &  arg_file,
std::vector< std::string > &  arg_msys_names 
)
inlinevirtual

Optional: Returns a list of muscle systems in a file. Required : If readMuscleSysFromFile() is implemented

virtual bool scl::CParserBase::listRobotsInFile ( const std::string &  arg_file,
std::vector< std::string > &  arg_robot_names 
)
pure virtual

Returns a list of robots and the files in which their specifications reside.

Implemented in scl::CParserOsimForOldFiles, scl::CParserOsim, scl::CParserScl, and scl::CParserSai.

virtual bool scl::CParserBase::listUISpecsInFile ( const std::string &  arg_file,
std::vector< std::string > &  arg_ui_spec_names 
)
inlinevirtual

Optional: If required, the subclass may support parsing user interface specifications.

Reimplemented in scl::CParserScl.

virtual bool scl::CParserBase::readGcControllerFromFile ( const std::string &  arg_file,
const std::string &  arg_ctrl_name,
std::string &  ret_must_use_robot,
scl::SControllerGc arg_ctrl 
)
inlinevirtual

Optional: The subclass may support parsing gc controller specifications (There are 2 different controller reading functions because the data structures are totally incompatible)

Reimplemented in scl::CParserScl.

virtual bool scl::CParserBase::readGraphicsFromFile ( const std::string &  arg_file,
const std::string &  arg_graphics_name,
scl::SGraphicsParsed arg_graphics 
)
inlinevirtual

Optional: If required, the subclass may support parsing graphics specifications.

Parameters
arg_graphicsThe robot's data will be filled into this data structure

Reimplemented in scl::CParserSai, and scl::CParserScl.

virtual bool scl::CParserBase::readMuscleSysFromFile ( const std::string &  arg_file,
const std::string &  arg_msys_name,
scl::SActuatorSetMuscleParsed arg_msys 
)
inlinevirtual

Reads a muscle model from a file.

Reimplemented in scl::CParserOsimForOldFiles, and scl::CParserOsim.

virtual bool scl::CParserBase::readRobotFromFile ( const std::string &  arg_file,
const std::string &  arg_robot_name,
scl::SRobotParsed arg_robot 
)
pure virtual

Required : Reads in a robot from the given file.

This function must be implemented by parsers who inherit from CParserBase. Its implementation will depend on the file format supported.

NOTE : Subclass implementation details for the readRobotFromFile() function: 1) Add a bunch of SRigidBody links to the SRobotParsed's branching representation, "robot_.robot_br_rep_", after reading in the values from a file 2) When all the links have been read in, call "robot_.robot_br_rep_.linkNodes()"

If you want to implement a new parser for a new filetype, please see how you should populate the SRobotParsed data structure from an existing parser. Eg. The Scl parser implements the full API

Parameters
arg_robot_nameThe spec which will be instantiated in the object
arg_robotThe robot's data will be filled into this data structure

Implemented in scl::CParserOsimForOldFiles, scl::CParserOsim, scl::CParserSai, and scl::CParserScl.

virtual bool scl::CParserBase::readTaskControllerFromFile ( const std::string &  arg_file,
const std::string &  arg_ctrl_name,
std::string &  ret_must_use_robot,
std::vector< scl::STaskBase * > &  ret_taskvec,
std::vector< scl::SNonControlTaskBase * > &  ret_task_non_ctrl_vec 
)
inlinevirtual

Optional: The subclass may support parsing task controller specifications (There are 2 different controller reading functions because the data structures are totally incompatible)

Parameters
ret_taskvecReturns a vector of tasks that this task controller can execute. Typically, the task controller will execute all of them simultaneously with a priority order.

Reimplemented in scl::CParserScl.

virtual bool scl::CParserBase::readUISpecFromFile ( const std::string &  arg_file,
const std::string &  arg_ui_spec_name,
scl::SUIParsed arg_ui_spec 
)
inlinevirtual

Optional: If required, the subclass may support parsing user interface specifications.

Reimplemented in scl::CParserScl.

virtual bool scl::CParserBase::saveRobotToFile ( scl::SRobotParsed arg_robot,
const std::string &  arg_file 
)
inlinevirtual

Saves a robot definition to file. Takes the name of the robot and a file name as aguments.

Looks up the robot in the database and writes it to a file if it exists.

Reimplemented in scl::CParserSai, and scl::CParserScl.


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