Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

SineMC Class Reference

Moves one or more outputs through a sinusoidal pattern. More...

#include <SineMC.h>

Inheritance diagram for SineMC:

Detailed Description

Moves one or more outputs through a sinusoidal pattern.

Definition at line 10 of file SineMC.h.

List of all members.

Public Member Functions

 SineMC ()
 constructor, sets default parameters to use full range of each joint, with a period of 2 seconds, but all weights to zero
virtual void setWeight (unsigned int i, float w)
 sets the weight of an output, zero-weighted outputs are ignored
virtual float getWeight (unsigned int i) const
 gets the weight of an output, zero-weighted outputs are ignored
virtual void setParams (unsigned int i, float amplitude, unsigned int period_time, float offset_value, unsigned int offset_time)
 sets the sine wave parameters
virtual void setParams (unsigned int i, float amplitude, unsigned int period_time, float offset_value)
 sets the sine wave parameters
virtual float getAmplitude (unsigned int i) const
 gets the peak-to-center amplitude
virtual unsigned int getPeriod (unsigned int i) const
 gets the period of the oscillation (milliseconds)
virtual float getOffsetValue (unsigned int i) const
 gets the center position of the oscillation
virtual unsigned int getOffsetTime (unsigned int i) const
 gets the phase shift of the oscillation
virtual float getPhase (unsigned int i) const
 returns the percent of period completed
virtual float getCount (unsigned int i) const
 returns the percent of period completed
virtual float getPosition (unsigned int i) const
 returns the current target position of the specified output
virtual float getSpeed (unsigned int i) const
 returns the current target speed of the specified output (radians/sec)
virtual float getAcceleration (unsigned int i) const
 returns the current target acceleration of the specified output (radians/sec^2)
virtual void sync (unsigned int i)
 sets the offset_time of a specified output to match its current position so it won't suddenly snap to a new position
virtual void sync (unsigned int i, unsigned int t)
 sets the offset_time of a specified output to match its current position so it won't suddenly snap to a new position
virtual void syncAll ()
 sets the offset_time of all non-zero weighted joints to use the closest common phase, keeping all outputs in phase
virtual int updateOutputs ()
 is called once per update cycle, can do any processing you need to change your priorities or set output commands on the MotionManager
virtual int isDirty ()
 not used by MotionManager at the moment, but could be used to reduce recomputation, and you may find it useful
virtual int isAlive ()
 used to prune "dead" motions from the MotionManager

Protected Attributes

OutputCmd cmds [NumOutputs]
float amp [NumOutputs]
unsigned int period [NumOutputs]
float offset [NumOutputs]
unsigned int start [NumOutputs]
unsigned int lastUpdate

Constructor & Destructor Documentation

SineMC::SineMC (  ) 

constructor, sets default parameters to use full range of each joint, with a period of 2 seconds, but all weights to zero

Definition at line 13 of file SineMC.h.


Member Function Documentation

virtual float SineMC::getAcceleration ( unsigned int  i  )  const [virtual]

returns the current target acceleration of the specified output (radians/sec^2)

Definition at line 82 of file SineMC.h.

virtual float SineMC::getAmplitude ( unsigned int  i  )  const [virtual]

gets the peak-to-center amplitude

Definition at line 59 of file SineMC.h.

virtual float SineMC::getCount ( unsigned int  i  )  const [virtual]

returns the percent of period completed

Definition at line 70 of file SineMC.h.

Referenced by getPhase().

virtual unsigned int SineMC::getOffsetTime ( unsigned int  i  )  const [virtual]

gets the phase shift of the oscillation

Definition at line 65 of file SineMC.h.

virtual float SineMC::getOffsetValue ( unsigned int  i  )  const [virtual]

gets the center position of the oscillation

Definition at line 63 of file SineMC.h.

virtual unsigned int SineMC::getPeriod ( unsigned int  i  )  const [virtual]

gets the period of the oscillation (milliseconds)

Definition at line 61 of file SineMC.h.

virtual float SineMC::getPhase ( unsigned int  i  )  const [virtual]

returns the percent of period completed

Definition at line 68 of file SineMC.h.

virtual float SineMC::getPosition ( unsigned int  i  )  const [virtual]

returns the current target position of the specified output

Definition at line 73 of file SineMC.h.

virtual float SineMC::getSpeed ( unsigned int  i  )  const [virtual]

returns the current target speed of the specified output (radians/sec)

Definition at line 75 of file SineMC.h.

virtual float SineMC::getWeight ( unsigned int  i  )  const [virtual]

gets the weight of an output, zero-weighted outputs are ignored

Definition at line 25 of file SineMC.h.

virtual int SineMC::isAlive (  )  [virtual]

used to prune "dead" motions from the MotionManager

note that a motion could be "paused" or inactive and therefore not dirty, but still alive, biding its time to "strike" ;)

Returns:
zero if the motion is still processing, non-zero otherwise

Implements MotionCommand.

Definition at line 151 of file SineMC.h.

virtual int SineMC::isDirty (  )  [virtual]

not used by MotionManager at the moment, but could be used to reduce recomputation, and you may find it useful

Returns:
zero if none of the commands have changed since last getJointCmd(), else non-zero

Implements MotionCommand.

Definition at line 150 of file SineMC.h.

virtual void SineMC::setParams ( unsigned int  i,
float  amplitude,
unsigned int  period_time,
float  offset_value 
) [virtual]

sets the sine wave parameters

Parameters:
i the index of the output
amplitude the peak-to-center amplitude
period_time the period of the oscillation (milliseconds)
offset_value sets the center position of the oscillation

The offset time is synced to maintain current position. If the output weight is 0, it is set to 1.

Definition at line 50 of file SineMC.h.

virtual void SineMC::setParams ( unsigned int  i,
float  amplitude,
unsigned int  period_time,
float  offset_value,
unsigned int  offset_time 
) [virtual]

sets the sine wave parameters

Parameters:
i the index of the output
amplitude the peak-to-center amplitude
period_time the period of the oscillation (milliseconds)
offset_value sets the center position of the oscillation
offset_time sets the phase shift of the oscillation

If the output weight is 0, it is set to 1.

Definition at line 35 of file SineMC.h.

virtual void SineMC::setWeight ( unsigned int  i,
float  w 
) [virtual]

sets the weight of an output, zero-weighted outputs are ignored

Definition at line 23 of file SineMC.h.

virtual void SineMC::sync ( unsigned int  i,
unsigned int  t 
) [virtual]

sets the offset_time of a specified output to match its current position so it won't suddenly snap to a new position

Definition at line 93 of file SineMC.h.

virtual void SineMC::sync ( unsigned int  i  )  [virtual]

sets the offset_time of a specified output to match its current position so it won't suddenly snap to a new position

Definition at line 90 of file SineMC.h.

Referenced by setParams(), SineMC(), sync(), and syncAll().

virtual void SineMC::syncAll (  )  [virtual]

sets the offset_time of all non-zero weighted joints to use the closest common phase, keeping all outputs in phase

Definition at line 104 of file SineMC.h.

virtual int SineMC::updateOutputs (  )  [virtual]

is called once per update cycle, can do any processing you need to change your priorities or set output commands on the MotionManager

Returns:
zero if no changes were made, non-zero otherwise
See also:
RobotInfo::NumFrames
RobotInfo::FrameTime

Implements MotionCommand.

Definition at line 117 of file SineMC.h.


Member Data Documentation

float SineMC::amp[NumOutputs] [protected]

Definition at line 155 of file SineMC.h.

Referenced by getAcceleration(), getAmplitude(), getSpeed(), setParams(), SineMC(), sync(), and updateOutputs().

OutputCmd SineMC::cmds[NumOutputs] [protected]
unsigned int SineMC::lastUpdate [protected]

Definition at line 159 of file SineMC.h.

Referenced by getAcceleration(), getSpeed(), SineMC(), and updateOutputs().

float SineMC::offset[NumOutputs] [protected]

Definition at line 157 of file SineMC.h.

Referenced by getOffsetValue(), setParams(), SineMC(), sync(), and updateOutputs().

unsigned int SineMC::period[NumOutputs] [protected]
unsigned int SineMC::start[NumOutputs] [protected]

Definition at line 158 of file SineMC.h.


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

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:16 2016 by Doxygen 1.6.3