jspace::State Class Reference

#include <State.hpp>

Collaboration diagram for jspace::State:

Collaboration graph
[legend]

List of all members.

Public Types

enum  compare_flags_t {
  COMPARE_ACQUISITION_TIME = 0x1, COMPARE_POSITION = 0x2, COMPARE_VELOCITY = 0x4, COMPARE_FORCE = 0x8,
  COMPARE_ALL = 0xf
}

Public Member Functions

 State ()
 State (State const &orig)
 State (size_t npos, size_t nvel, size_t nforce)
void init (size_t npos, size_t nvel, size_t nforce)
 Resizes and zeros-out position_, velocity_, and force_ to the desired lengths.
void resizeAndPadWithZeros (size_t npos, size_t nvel, size_t nforce)
 Resize position_, velocity_, and force_ to the desired lengths and, if necessary, pad them with zeros.
bool equal (State const &rhs, int flags=COMPARE_POSITION|COMPARE_VELOCITY, double precision=1e-3) const
 Compares two states for equality.
Stateoperator= (State const &rhs)

Public Attributes

size_t time_sec_
size_t time_usec_
Vector position_
Vector velocity_
Vector force_


Detailed Description

Definition at line 33 of file State.hpp.


Member Enumeration Documentation

enum jspace::State::compare_flags_t

Enumerator:
COMPARE_ACQUISITION_TIME 
COMPARE_POSITION 
COMPARE_VELOCITY 
COMPARE_FORCE 
COMPARE_ALL 

Definition at line 36 of file State.hpp.


Constructor & Destructor Documentation

jspace::State::State (  ) 

Definition at line 35 of file State.cpp.

References init().

Here is the call graph for this function:

jspace::State::State ( State const &  orig  ) 

Definition at line 42 of file State.cpp.

jspace::State::State ( size_t  npos,
size_t  nvel,
size_t  nforce 
)

Definition at line 49 of file State.cpp.

References init().

Here is the call graph for this function:


Member Function Documentation

void jspace::State::init ( size_t  npos,
size_t  nvel,
size_t  nforce 
)

Resizes and zeros-out position_, velocity_, and force_ to the desired lengths.

Also sets the timestamp to zero.

Definition at line 56 of file State.cpp.

References force_, position_, time_sec_, time_usec_, and velocity_.

Referenced by tutsim::run(), and State().

void jspace::State::resizeAndPadWithZeros ( size_t  npos,
size_t  nvel,
size_t  nforce 
)

Resize position_, velocity_, and force_ to the desired lengths and, if necessary, pad them with zeros.

Neither the existing values nor the timestamp get modified by this method.

Note:
This method is intended as a cheap way to avoid segfaults when feeding user-provided data to jspace::Model::update() or similar. In a "real" application, your State and Model should definitely be guaranteed to agree on the dimensions of position_, velocity_, and force_.

Definition at line 95 of file State.cpp.

References jspace::_pad(), force_, position_, and velocity_.

Here is the call graph for this function:

bool jspace::State::equal ( State const &  rhs,
int  flags = COMPARE_POSITION | COMPARE_VELOCITY,
double  precision = 1e-3 
) const

Compares two states for equality.

You can specify which aspects of the state should be considered relevant, and also a precision for comparing floating point values.

Definition at line 119 of file State.cpp.

References jspace::compare(), COMPARE_ACQUISITION_TIME, COMPARE_FORCE, COMPARE_POSITION, COMPARE_VELOCITY, force_, position_, time_sec_, time_usec_, and velocity_.

Here is the call graph for this function:

State & jspace::State::operator= ( State const &  rhs  ) 

Definition at line 104 of file State.cpp.

References force_, position_, time_sec_, time_usec_, and velocity_.


Member Data Documentation

size_t jspace::State::time_sec_

Definition at line 78 of file State.hpp.

Referenced by equal(), init(), and operator=().

size_t jspace::State::time_usec_

Definition at line 79 of file State.hpp.

Referenced by equal(), init(), and operator=().

Vector jspace::State::position_

Definition at line 80 of file State.hpp.

Referenced by jspace::JointGoalController::computeCommand(), equal(), init(), jspace::GoalControllerBase::init(), jspace::JointGoalController::latch(), operator=(), read_state_from_tree(), resizeAndPadWithZeros(), servo_cb(), and write_state_to_tree().

Vector jspace::State::velocity_

Definition at line 81 of file State.hpp.

Referenced by jspace::JointGoalController::computeCommand(), equal(), init(), operator=(), read_state_from_tree(), resizeAndPadWithZeros(), servo_cb(), tut05::PTask::updateStateAndJacobian(), and write_state_to_tree().

Vector jspace::State::force_

Definition at line 82 of file State.hpp.

Referenced by equal(), init(), operator=(), read_state_from_tree(), and resizeAndPadWithZeros().


The documentation for this class was generated from the following files:
Generated on Fri Aug 26 01:32:54 2011 for Stanford Whole-Body Control Framework by  doxygen 1.5.4