KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Protected Member Functions | List of all members
kjb::psi::Simple_simulator Class Reference

#include <psi_cylinder_world.h>

Public Member Functions

 Simple_simulator ()
 
bool simulate (const std::vector< std::vector< Start_state > > &start_state, const std::vector< std::vector< std::vector< Action > > > &actions)
 
const std::vector< std::vector
< std::vector< Entity_state > > > & 
get_entity_states () const
 returns 2d array or entity states, indexed by states[actor][frame] More...
 
void set_sampling_rate (double r)
 

Protected Member Functions

double get_actions_length (const std::vector< Action > &actions)
 return the length of simulation, as defined by a sequence of extended actions More...
 
std::vector< size_t > quantize_action_durations (const std::vector< Action > &actions)
 
std::vector< double > quantize_walk_through_points_action (const std::vector< double > &parameters)
 
void execute_action (size_t time, Action_context &context)
 
void execute_null_action (size_t time, Action_context &context)
 
void execute_walk_action (size_t time, Action_context &context)
 
void execute_walk_in_arc_action (size_t time, Action_context &context)
 
void execute_walk_through_points_action (size_t time, Action_context &context)
 
void execute_follow_action (size_t time, Action_context &context)
 

Constructor & Destructor Documentation

kjb::psi::Simple_simulator::Simple_simulator ( )
inline

Member Function Documentation

void kjb::psi::Simple_simulator::execute_action ( size_t  time,
Action_context &  context 
)
inlineprotected

Run an action for N time-steps. Saves the state at every time-step in the state log, and updates the time counter.

Parameters
timeThe time index to start running the action. After returning, time will be updated to be the time index for the next action to start running.
Precondition
All states for entity at previous times have already been computed.
void kjb::psi::Simple_simulator::execute_follow_action ( size_t  time,
Action_context &  context 
)
protected

Handler for "follow" action.

Parameters
timeThe time index to start running the action. After returning, time will be updated to be the time index for the next action to start running. Must be > 0.
entity_1the actor that is being followed
entity_2the actor is following entity_1
Returns
Amount to add to next action's duration, to account for time discretization over/underrun error.
Precondition
All states for entity at previous times have already been computed.
See Also
execute_action
void kjb::psi::Simple_simulator::execute_null_action ( size_t  time,
Action_context &  context 
)
protected

Handler for "null" activity.

See Also
execute_action
void kjb::psi::Simple_simulator::execute_walk_action ( size_t  time,
Action_context &  context 
)
protected

Handler for "walk" action.

Precondition
All previous states for all entities have been computed.
Current states for all dependency entities have been computed.
See Also
execute_action
void kjb::psi::Simple_simulator::execute_walk_in_arc_action ( size_t  time,
Action_context &  context 
)
protected

Handler for "walk-and-turn" action

Parameters
timeThe time index to start running the action. After returning, time will be updated to be the time index for the next action to start running. Must be > 0.
void kjb::psi::Simple_simulator::execute_walk_through_points_action ( size_t  time,
Action_context &  context 
)
protected

Handler for "walk_though_points" action.

Parameters
timeThe time index to start running the action. After returning, time will be updated to be the time index for the next action to start running. Must be > 0.
Returns
Amount to add to next action's duration, to account for time discretization over/underrun error.
Precondition
All states for entity at previous times have already been computed.
See Also
execute_action
double kjb::psi::Simple_simulator::get_actions_length ( const std::vector< Action > &  actions)
protected

return the length of simulation, as defined by a sequence of extended actions

If multiple cylinders, and one's actions take longer than another's, this adds a null action to the shorter one so they're all the same length.

Precondition
total duration of all actions is <= duration
const std::vector<std::vector<std::vector<Entity_state> > >& kjb::psi::Simple_simulator::get_entity_states ( ) const
inline

returns 2d array or entity states, indexed by states[actor][frame]

std::vector< size_t > kjb::psi::Simple_simulator::quantize_action_durations ( const std::vector< Action > &  actions)
protected

Convert action durations from seconds (float point) to sample counts (integers). Takes care to not accumulate drift over long trajectories.

std::vector<double> kjb::psi::Simple_simulator::quantize_walk_through_points_action ( const std::vector< double > &  parameters)
protected

Document soon... Quantize the WALK_THROUGH_POINTS_ACTION into

void kjb::psi::Simple_simulator::set_sampling_rate ( double  r)
inline
bool kjb::psi::Simple_simulator::simulate ( const std::vector< std::vector< Start_state > > &  start_state,
const std::vector< std::vector< std::vector< Action > > > &  actions 
)

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