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 | Private Member Functions | List of all members
scl::CParserScl Class Reference

#include <CParserScl.hpp>

Inheritance diagram for scl::CParserScl:
Inheritance graph
[legend]
Collaboration diagram for scl::CParserScl:
Collaboration graph
[legend]

Public Member Functions

virtual bool listRobotsInFile (const std::string &arg_file, std::vector< std::string > &arg_robot_names)
 
virtual bool readRobotFromFile (const std::string &arg_file, const std::string &arg_robot_name, scl::SRobotParsed &arg_robot_object)
 
virtual bool saveRobotToFile (scl::SRobotParsed &arg_robot, const std::string &arg_file)
 
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)
 
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)
 

Private Member Functions

bool readRobotSpecFromFile (const std::string &arg_spec_file, const std::string &arg_robot_spec_name, scl::SRobotParsed &arg_robot)
 
virtual bool readActuatorSetMuscleFromFile (const std::string &arg_spec_file, const std::string &arg_muscle_set_name, scl::SActuatorSetMuscleParsed &ret_mset)
 

Detailed Description

This class implements the entire CParserBase API.

It represents the file format of choice for scl.

Please see the CParserBase API for more details.

Member Function Documentation

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

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 from scl::CParserBase.

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

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

Reimplemented from scl::CParserBase.

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

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

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

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

Implements scl::CParserBase.

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

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

Reimplemented from scl::CParserBase.

bool scl::CParserScl::readActuatorSetMuscleFromFile ( const std::string &  arg_spec_file,
const std::string &  arg_muscle_set_name,
scl::SActuatorSetMuscleParsed ret_mset 
)
privatevirtual

Reads a robot's actuator set specification from a file. NOTE : This function is private because it does not seem reasonable to want to parse a muscle set without actually attaching it to a robot. As such actuator sets (in general) will be parsed with the readRobot. They are considered an intrinsic part of the robot's structure.

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

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

Reimplemented from scl::CParserBase.

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

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

Reimplemented from scl::CParserBase.

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

Reads a muscle model from a file.

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

bool scl::CParserScl::readRobotFromFile ( const std::string &  arg_file,
const std::string &  arg_robot_name,
scl::SRobotParsed arg_robot 
)
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

Implements scl::CParserBase.

bool scl::CParserScl::readRobotSpecFromFile ( const std::string &  arg_spec_file,
const std::string &  arg_robot_spec_name,
scl::SRobotParsed arg_robot 
)
private

Reads a robot specification from a file

bool scl::CParserScl::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 
)
virtual

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


PARSE ALL THE CONTROL TASKS HERE



PARSE ALL THE STANDARD CONTROLLER OPTIONS

These are contained in the STaskBase data structure


PARSE ALL THE NON STANDARD CONTROLLER OPTIONS

These are not contained in the STaskBase data structure. Each task should know what to do with them (in its init function).


END PARSING CONTROLLER OPTIONS


END PARSING ALL THE CONTROL TASKS HERE



PARSE ALL THE NON-CONTROL TASKS HERE



PARSE ALL THE STANDARD CONTROLLER OPTIONS

These are contained in the STaskBase data structure


PARSE ALL THE NON STANDARD CONTROLLER OPTIONS

These are not contained in the SNonControlTaskBase data structure. Each task should know what to do with them (in its init function).


END PARSING ALL THE NON-CONTROL TASKS HERE


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 from scl::CParserBase.

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

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

Reimplemented from scl::CParserBase.

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

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.

Root link

Loop over other links.

Reimplemented from scl::CParserBase.


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