Homepage Demos Overview Downloads Tutorials Reference
Credits
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Search

WalkMC Class Reference

#include <WalkMC.h>

Inheritance diagram for WalkMC:

Inheritance graph
[legend]
List of all members.

Detailed Description

A nice walking class from Carnegie Mellon University's 2001 Robosoccer team, modified to fit this framework, see their license.

Moves the feet through a looping path in order to walk - default parameters use a walk low to the ground so you don't walk over the ball.

This portion of the code falls under CMPack's license:

  =========================================================================
    CMPack'02 Source Code Release for OPEN-R SDK v1.0
    Copyright (C) 2002 Multirobot Lab [Project Head: Manuela Veloso]
    School of Computer Science, Carnegie Mellon University
  -------------------------------------------------------------------------
    This software is distributed under the GNU General Public License,
    version 2.  If you do not have a copy of this licence, visit
    www.gnu.org, or write: Free Software Foundation, 59 Temple Place,
    Suite 330 Boston, MA 02111-1307 USA.  This program is distributed
    in the hope that it will be useful, but WITHOUT ANY WARRANTY,
    including MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  -------------------------------------------------------------------------
    Additionally licensed to Sony Corporation under the following terms:

    This software is provided by the copyright holders AS IS and any
    express or implied warranties, including, but not limited to, the
    implied warranties of merchantability and fitness for a particular
    purpose are disclaimed.  In no event shall authors be liable for
    any direct, indirect, incidental, special, exemplary, or consequential
    damages (including, but not limited to, procurement of substitute
    goods or services; loss of use, data, or profits; or business
    interruption) however caused and on any theory of liability, whether
    in contract, strict liability, or tort (including negligence or
    otherwise) arising in any way out of the use of this software, even if
    advised of the possibility of such damage.
  =========================================================================

Definition at line 49 of file WalkMC.h.

Public Types

typedef SplinePath< vector3d,
double > 
splinepath
 for convenience

typedef HermiteSplineSegment<
vector3d, double > 
spline
 for convenience


Public Member Functions

 WalkMC (const char *pfile=NULL)
 constructor

virtual void DoStart ()
 sends an activate LocomotionEvent

virtual void DoStop ()
 sends a deactivate LocomotionEvent

virtual int updateOutputs ()
 calculates current positions of the paws

virtual int isDirty ()
 returns true if we are walking

virtual int isAlive ()
 always true - never autoprunes

void load (const char *pfile)
 loads parameters from a file (

void save (const char *pfile) const
 saves parameters to a file (

void setTargetVelocity (double dx, double dy, double da)
 set the direction to walk - can specify x (forward), y (left), and angular (counterclockwise) velocities

const vector3dgetTargetVelocity ()
 returns current velocity we're trying to go

const vector3dgetCurVelocity () const
 returns the velocity we're actually moving (subject to clipping at max_accel_xya), doesn't reflect value of getPaused()...

unsigned int getTravelTime ()
 returns the time we've been traveling along the current vector

void setPaused (bool p)
 if set to true, will stop moving

bool getPaused () const
 if is true, we aren't moving

void setHeight (double h)
 sets WalkParam::body_height of wp

double getHeight ()
 gets WalkParam::body_height of wp

void setAngle (double a)
 sets WalkParam::body_angle of wp

double getAngle ()
 gets WalkParam::body_angle of wp

void setHop (double h)
 sets WalkParam::hop of wp

double getHop ()
 gets WalkParam::hop of wp

void setSway (double h)
 sets WalkParam::sway of wp

double getSway ()
 gets WalkParam::sway of wp

void setPeriod (long p)
 sets WalkParam::period of wp

long getPeriod ()
 gets WalkParam::period of wp

void resetLegPos ()
 takes current leg positions from WorldState and tries to match the point in the cycle most like it


Static Public Attributes

const float MAX_DX = 180
 ==180 mm/sec

const float MAX_DY = 140
 ==140 mm/sec

const float MAX_DA = 1.8
 ==1.8 rad/sec

const vector3d max_accel_xya
 vector version of MAX_DX,MAX_DY,MAX_DA


Protected Member Functions

void init (const char *pfile)
 does some setup stuff, calls load(pfile)


Protected Attributes

OutputCmd cmds [NumOutputs][NumFrames]
 holds current joint commands

bool isPaused
 true if we are paused

WalkParam wp
 current walking parameters (note that it's not static - different WalkMC's can have different setting, handy...

LegWalkState legw [NumLegs]
 current state of each leg

vector3d legpos [NumLegs]
 current position of each leg

splinepath body_loc
 the path the body goes through while walking (?)

splinepath body_angle
 the path the body goes through while walking (?)

vector3d pos_delta
 how much we've moved

double angle_delta
 how much we've turned

unsigned int travelTime
 the time since the last call to setTargetVelocity - handy to check the time we've been traveling current vector

int time
 time of last call to updateJointCmds()

int TimeStep
 time to pretend passes between each call to updateJointCmds() - usually RobotInfo::FrameTime, unless you want to make it walk in slow motion (handy sometimes for debugging)

vector3d vel_xya
 the current velocity we're moving

vector3d target_vel_xya
 the velocity that was requested


Member Typedef Documentation

typedef HermiteSplineSegment<vector3d,double> WalkMC::spline
 

for convenience

Definition at line 52 of file WalkMC.h.

typedef SplinePath<vector3d,double> WalkMC::splinepath
 

for convenience

Definition at line 51 of file WalkMC.h.


Constructor & Destructor Documentation

WalkMC::WalkMC const char *  pfile = NULL  ) 
 

constructor

Definition at line 59 of file WalkMC.cc.

References ERS210Info::FrameTime, get_time(), init(), and time.


Member Function Documentation

void WalkMC::DoStart  )  [virtual]
 

sends an activate LocomotionEvent

Reimplemented from MotionCommand.

Definition at line 68 of file WalkMC.cc.

References EventBase::activateETID, MotionCommand::DoStart(), get_time(), MotionManagerMsg::getID(), EventBase::locomotionEGID, MotionCommand::postEvent(), LocomotionEvent::setXYA(), target_vel_xya, travelTime, GVector::vector3d< double >::x, GVector::vector3d< double >::y, and GVector::vector3d< double >::z.

void WalkMC::DoStop  )  [virtual]
 

sends a deactivate LocomotionEvent

Reimplemented from MotionCommand.

Definition at line 76 of file WalkMC.cc.

References EventBase::deactivateETID, MotionCommand::DoStop(), get_time(), MotionManagerMsg::getID(), EventBase::locomotionEGID, MotionCommand::postEvent(), LocomotionEvent::setXYA(), target_vel_xya, travelTime, GVector::vector3d< double >::x, GVector::vector3d< double >::y, and GVector::vector3d< double >::z.

double WalkMC::getAngle  )  [inline]
 

gets WalkParam::body_angle of wp

Definition at line 111 of file WalkMC.h.

References WalkMC::WalkParam::body_angle, and wp.

const vector3d& WalkMC::getCurVelocity  )  const [inline]
 

returns the velocity we're actually moving (subject to clipping at max_accel_xya), doesn't reflect value of getPaused()...

Definition at line 102 of file WalkMC.h.

References vel_xya.

double WalkMC::getHeight  )  [inline]
 

gets WalkParam::body_height of wp

Definition at line 109 of file WalkMC.h.

References WalkMC::WalkParam::body_height, and wp.

double WalkMC::getHop  )  [inline]
 

gets WalkParam::hop of wp

Definition at line 113 of file WalkMC.h.

References WalkMC::WalkParam::hop, and wp.

bool WalkMC::getPaused  )  const [inline]
 

if is true, we aren't moving

Definition at line 107 of file WalkMC.h.

References isPaused.

long WalkMC::getPeriod  )  [inline]
 

gets WalkParam::period of wp

Definition at line 117 of file WalkMC.h.

References WalkMC::WalkParam::period, and wp.

double WalkMC::getSway  )  [inline]
 

gets WalkParam::sway of wp

Definition at line 115 of file WalkMC.h.

References WalkMC::WalkParam::sway, and wp.

const vector3d& WalkMC::getTargetVelocity  )  [inline]
 

returns current velocity we're trying to go

Definition at line 100 of file WalkMC.h.

References target_vel_xya.

unsigned int WalkMC::getTravelTime  )  [inline]
 

returns the time we've been traveling along the current vector

Definition at line 104 of file WalkMC.h.

References get_time(), and travelTime.

void WalkMC::init const char *  pfile  )  [protected]
 

does some setup stuff, calls load(pfile)

Definition at line 85 of file WalkMC.cc.

References WalkMC::LegWalkState::air, WalkMC::WalkParam::body_angle, body_angle, WalkMC::WalkParam::body_height, body_loc, GetLegPosition(), SplinePath< vector3d, double >::init(), ERS210Info::JointsPerLeg, legpos, legw, load(), ERS210Info::NumLegs, vector3d, and wp.

virtual int WalkMC::isAlive  )  [inline, virtual]
 

always true - never autoprunes

Implements MotionCommand.

Definition at line 91 of file WalkMC.h.

virtual int WalkMC::isDirty  )  [inline, virtual]
 

returns true if we are walking

Implements MotionCommand.

Definition at line 90 of file WalkMC.h.

References isPaused, target_vel_xya, GVector::vector3d< double >::x, GVector::vector3d< double >::y, and GVector::vector3d< double >::z.

void WalkMC::load const char *  pfile  ) 
 

loads parameters from a file (

Todo:
use LoadSave)

Definition at line 109 of file WalkMC.cc.

References checksum(), mzero(), read_file(), and wp.

void WalkMC::resetLegPos  ) 
 

takes current leg positions from WorldState and tries to match the point in the cycle most like it

Definition at line 228 of file WalkMC.cc.

References GetLegPosition(), ERS210Info::JointsPerLeg, ERS210Info::LegOffset, legpos, ERS210Info::NumLegs, WorldState::outputs, and state.

void WalkMC::save const char *  pfile  )  const
 

saves parameters to a file (

Todo:
use LoadSave)

Definition at line 117 of file WalkMC.cc.

References checksum(), save_file(), and wp.

void WalkMC::setAngle double  a  )  [inline]
 

sets WalkParam::body_angle of wp

Definition at line 110 of file WalkMC.h.

References WalkMC::WalkParam::body_angle, and wp.

void WalkMC::setHeight double  h  )  [inline]
 

sets WalkParam::body_height of wp

Definition at line 108 of file WalkMC.h.

References WalkMC::WalkParam::body_height, and wp.

void WalkMC::setHop double  h  )  [inline]
 

sets WalkParam::hop of wp

Definition at line 112 of file WalkMC.h.

References WalkMC::WalkParam::hop, and wp.

void WalkMC::setPaused bool  p  )  [inline]
 

if set to true, will stop moving

Definition at line 106 of file WalkMC.h.

References isPaused.

void WalkMC::setPeriod long  p  )  [inline]
 

sets WalkParam::period of wp

Definition at line 116 of file WalkMC.h.

References WalkMC::WalkParam::period, and wp.

void WalkMC::setSway double  h  )  [inline]
 

sets WalkParam::sway of wp

Definition at line 114 of file WalkMC.h.

References WalkMC::WalkParam::sway, and wp.

void WalkMC::setTargetVelocity double  dx,
double  dy,
double  da
 

set the direction to walk - can specify x (forward), y (left), and angular (counterclockwise) velocities

Definition at line 123 of file WalkMC.cc.

References bound(), da, dx, get_time(), MotionManagerMsg::getID(), MotionCommand::isActive(), GVector::vector2d< num >::length(), EventBase::locomotionEGID, MAX_DA, MAX_DX, MAX_DY, MotionCommand::postEvent(), GVector::vector3d< double >::set(), LocomotionEvent::setXYA(), EventBase::statusETID, target_vel_xya, travelTime, GVector::vector2d< num >::x, and GVector::vector2d< num >::y.

int WalkMC::updateOutputs  )  [virtual]
 

calculates current positions of the paws

Implements MotionCommand.

Definition at line 148 of file WalkMC.cc.

References WalkMC::LegWalkState::air, WalkMC::LegWalkState::airpath, BodyPosition::angle, angle_delta, WalkMC::WalkParam::body_angle, WalkMC::WalkParam::body_height, bound(), cmds, HermiteSplineSegment< vector3d, double >::create(), WalkMC::LegParam::down_time, WalkMC::LegParam::down_vel, HermiteSplineSegment< vector3d, double >::eval(), get_time(), GetLegAngles(), WalkMC::WalkParam::hop, isDirty(), ERS210Info::JointsPerLeg, WalkMC::WalkParam::leg, ERS210Info::LegOffset, legpos, legw, WalkMC::LegParam::lift_time, WalkMC::LegParam::lift_vel, BodyPosition::loc, max_accel_xya, motman, WalkMC::LegParam::neutral, ERS210Info::NumFrames, ERS210Info::NumLegJoints, ERS210Info::NumLegs, WalkMC::WalkParam::period, pos_delta, GVector::vector3d< double >::rotate_z(), GVector::vector3d< double >::set(), MotionManager::setOutput(), WalkMC::WalkParam::sway, target_vel_xya, time, TimeStep, vel_xya, wp, GVector::vector3d< double >::x, GVector::vector3d< double >::y, and GVector::vector3d< double >::z.


Member Data Documentation

double WalkMC::angle_delta [protected]
 

how much we've turned

Definition at line 144 of file WalkMC.h.

splinepath WalkMC::body_angle [protected]
 

the path the body goes through while walking (?)

Definition at line 141 of file WalkMC.h.

splinepath WalkMC::body_loc [protected]
 

the path the body goes through while walking (?)

Definition at line 140 of file WalkMC.h.

OutputCmd WalkMC::cmds[NumOutputs][NumFrames] [protected]
 

holds current joint commands

Definition at line 129 of file WalkMC.h.

bool WalkMC::isPaused [protected]
 

true if we are paused

Definition at line 135 of file WalkMC.h.

vector3d WalkMC::legpos[NumLegs] [protected]
 

current position of each leg

Definition at line 139 of file WalkMC.h.

LegWalkState WalkMC::legw[NumLegs] [protected]
 

current state of each leg

Definition at line 138 of file WalkMC.h.

const vector3d WalkMC::max_accel_xya [static]
 

vector version of MAX_DX,MAX_DY,MAX_DA

const float WalkMC::MAX_DA = 1.8 [static]
 

==1.8 rad/sec

Definition at line 52 of file WalkMC.cc.

const float WalkMC::MAX_DX = 180 [static]
 

==180 mm/sec

Definition at line 50 of file WalkMC.cc.

const float WalkMC::MAX_DY = 140 [static]
 

==140 mm/sec

Definition at line 51 of file WalkMC.cc.

vector3d WalkMC::pos_delta [protected]
 

how much we've moved

Definition at line 143 of file WalkMC.h.

vector3d WalkMC::target_vel_xya [protected]
 

the velocity that was requested

Definition at line 151 of file WalkMC.h.

int WalkMC::time [protected]
 

time of last call to updateJointCmds()

Definition at line 147 of file WalkMC.h.

int WalkMC::TimeStep [protected]
 

time to pretend passes between each call to updateJointCmds() - usually RobotInfo::FrameTime, unless you want to make it walk in slow motion (handy sometimes for debugging)

Definition at line 148 of file WalkMC.h.

unsigned int WalkMC::travelTime [protected]
 

the time since the last call to setTargetVelocity - handy to check the time we've been traveling current vector

Definition at line 146 of file WalkMC.h.

vector3d WalkMC::vel_xya [protected]
 

the current velocity we're moving

Definition at line 150 of file WalkMC.h.

WalkParam WalkMC::wp [protected]
 

current walking parameters (note that it's not static - different WalkMC's can have different setting, handy...

Definition at line 137 of file WalkMC.h.


The documentation for this class was generated from the following files:
Tekkotsu v1.4
Generated Sat Jul 19 00:09:15 2003 by Doxygen 1.3.2