OpenSim Moco  0.4.0
Public Member Functions | List of all members
OpenSim::TableProcessor Class Reference

Description

This class describes a workflow for processing a table using TableOperators.

The user must provide a source table either as a filepath to a table or an in-memory TimeSeriesTable. In C++, one can easily chain together the operators in a processor using the C++ pipe operator:

TableProcessor proc = TableProcessor("file.sto") | TabOpLowPassFilter(6);
Examples:
example2DWalking.cpp, exampleMocoInverse.cpp, and exampleMocoTrack.cpp.
Inheritance diagram for OpenSim::TableProcessor:

#include <Moco/Moco/Common/TableProcessor.h>

Public Member Functions

 OpenSim_DECLARE_PROPERTY (filepath, std::string, "File path to a TimeSeriesTable.")
 
 OpenSim_DECLARE_LIST_PROPERTY (operators, TableOperator, "Operators to apply to the source table of this processor.")
 
 TableProcessor ()
 This constructor is only for use when reading (deserializing) from an XML file. More...
 
 TableProcessor (TimeSeriesTable table)
 Use an in-memory TimeSeriesTable as the source table. More...
 
 TableProcessor (std::string filepath)
 Use a filepath as the source table. More...
 
TimeSeriesTable process (std::string relativeToDirectory, const Model *model=nullptr) const
 Process and obtain the table. More...
 
TimeSeriesTable process (const Model *model=nullptr) const
 Same as above, but paths are evaluated with respect to the current working directory. More...
 
bool empty () const
 Returns true if neither a filepath nor an in-memory table have been provided. More...
 
TableProcessorappend (const TableOperator &op)
 Append an operation to the end of the operations in this processor.
 
TableProcessorappend (const TableProcessor &traj)
 Append all operations in another processor to this processor. More...
 
TableProcessoroperator| (const TableOperator &right)
 This operator allows one to write the following code in C++: More...
 

Constructor & Destructor Documentation

◆ TableProcessor() [1/3]

OpenSim::TableProcessor::TableProcessor ( )
inline

This constructor is only for use when reading (deserializing) from an XML file.

◆ TableProcessor() [2/3]

OpenSim::TableProcessor::TableProcessor ( TimeSeriesTable  table)
inline

Use an in-memory TimeSeriesTable as the source table.

Since this constructor is not explicit, you can provide a TimeSeriesTable to any function that takes a TableProcessor (in C++).

◆ TableProcessor() [3/3]

OpenSim::TableProcessor::TableProcessor ( std::string  filepath)
inline

Use a filepath as the source table.

Since this constructor is not explicit, you can provide a string filepath to any function that takes a TableProcessor.

Member Function Documentation

◆ append()

TableProcessor& OpenSim::TableProcessor::append ( const TableProcessor traj)
inline

Append all operations in another processor to this processor.

The source table of the provided trajectory is ignored.

◆ empty()

bool OpenSim::TableProcessor::empty ( ) const
inline

Returns true if neither a filepath nor an in-memory table have been provided.

◆ operator|()

TableProcessor& OpenSim::TableProcessor::operator| ( const TableOperator right)
inline

This operator allows one to write the following code in C++:

TableProcessor proc = TableProcessor("file.sto") |
TabOpLowPassFilter(6);

◆ process() [1/2]

TimeSeriesTable OpenSim::TableProcessor::process ( std::string  relativeToDirectory,
const Model *  model = nullptr 
) const
inline

Process and obtain the table.

If a filepath is provided, it will be evaluated relative relativeToDirectory. If a model is provided, it is used to convert columns from degrees to radians (if the table has a header with inDegrees=yes) before any operations are performed. This model is accessible by any TableOperators that require it.

◆ process() [2/2]

TimeSeriesTable OpenSim::TableProcessor::process ( const Model *  model = nullptr) const
inline

Same as above, but paths are evaluated with respect to the current working directory.


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