Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

WalkEdit.cc

Go to the documentation of this file.
00001 #include "Shared/RobotInfo.h"
00002 #ifdef TGT_IS_AIBO
00003 
00004 #include "WalkEdit.h"
00005 #include "Behaviors/Mon/WalkController.h"
00006 #include "Behaviors/Controls/LoadWalkControl.h"
00007 #include "Behaviors/Controls/SaveWalkControl.h"
00008 #include "Behaviors/Controls/ValueEditControl.h"
00009 #include "Behaviors/Controls/WalkCalibration.h"
00010 #include "Behaviors/Controls/LoadCalibration.h"
00011 
00012 using namespace std; 
00013 
00014 void WalkEdit::init() {
00015   menuStack.push(this);
00016   
00017 #if defined(PLATFORM_APERIOS) && (defined(TGT_ERS210) || defined(TGT_ERS220) || defined(TGT_ERS2xx))
00018   // Replace this if section with an #if 1 to re-enable
00019   // This functionality takes about 1MB of memory on the Aibo between loading the binary
00020   // code and the actual control memory usage.
00021   addItem(new ControlBase("Disabled to conserve memory"));
00022 #else
00023   
00024   //Use this instance of the GUI to try out changes you have made to parameters within this editor
00025   //(the one in TekkotsuMon will load fresh parameters from walk.prm on disk and won't know about changes made here)
00026   WalkController * walker = new WalkController();
00027   addItem((new BehaviorSwitchControlBase("Walk GUI: test changes",walker)));
00028   
00029   addItem(new ValueEditControl<float>("Slow Motion",walker->getWalkMC()->getSlowMo()));
00030   
00031   startSubMenu("Body","Edit the walk parameters");
00032   { 
00033     addItem(new ValueEditControl<double>("Body Height",&walker->getWalkMC()->getWP().body_height));
00034     addItem(new ValueEditControl<double>("Body Angle",&walker->getWalkMC()->getWP().body_angle));
00035     addItem(new ValueEditControl<double>("Hop",&walker->getWalkMC()->getWP().hop));
00036     addItem(new ValueEditControl<double>("Sway",&walker->getWalkMC()->getWP().sway));
00037     addItem(new ValueEditControl<int>("Period",&walker->getWalkMC()->getWP().period));
00038     addItem(new ValueEditControl<int>("Use Diff Drive",&walker->getWalkMC()->getWP().useDiffDrive));
00039     addItem(new ValueEditControl<float>("Sag",&walker->getWalkMC()->getWP().sag));
00040   }
00041   endSubMenu();
00042   
00043   startSubMenu("Neutral","Edit the walk parameters");
00044   { 
00045     addItem(new ValueEditControl<double>("NeuLeg[xFL]",&walker->getWalkMC()->getWP().leg[0].neutral.x));
00046     addItem(new ValueEditControl<double>("NeuLeg[xFR]",&walker->getWalkMC()->getWP().leg[1].neutral.x));
00047     addItem(new ValueEditControl<double>("NeuLeg[xBL]",&walker->getWalkMC()->getWP().leg[2].neutral.x));
00048     addItem(new ValueEditControl<double>("NeuLeg[xBR]",&walker->getWalkMC()->getWP().leg[3].neutral.x));
00049     addItem(new ValueEditControl<double>("NeuLeg[yFL]",&walker->getWalkMC()->getWP().leg[0].neutral.y));
00050     addItem(new ValueEditControl<double>("NeuLeg[yFR]",&walker->getWalkMC()->getWP().leg[1].neutral.y));
00051     addItem(new ValueEditControl<double>("NeuLeg[yBL]",&walker->getWalkMC()->getWP().leg[2].neutral.y));
00052     addItem(new ValueEditControl<double>("NeuLeg[yBR]",&walker->getWalkMC()->getWP().leg[3].neutral.y));
00053     addItem(new ValueEditControl<double>("NeuLeg[zFL]",&walker->getWalkMC()->getWP().leg[0].neutral.z));
00054     addItem(new ValueEditControl<double>("NeuLeg[zFR]",&walker->getWalkMC()->getWP().leg[1].neutral.z));
00055     addItem(new ValueEditControl<double>("NeuLeg[zBL]",&walker->getWalkMC()->getWP().leg[2].neutral.z));
00056     addItem(new ValueEditControl<double>("NeuLeg[zBR]",&walker->getWalkMC()->getWP().leg[3].neutral.z));
00057   }
00058   endSubMenu();
00059   
00060   startSubMenu("lift_vel","Edit the walk parameters");
00061   { 
00062     addItem(new ValueEditControl<double>("liftLeg[xFL]",&walker->getWalkMC()->getWP().leg[0].lift_vel.x));
00063     addItem(new ValueEditControl<double>("liftLeg[xFR]",&walker->getWalkMC()->getWP().leg[1].lift_vel.x));
00064     addItem(new ValueEditControl<double>("liftLeg[xBL]",&walker->getWalkMC()->getWP().leg[2].lift_vel.x));
00065     addItem(new ValueEditControl<double>("liftLeg[xBR]",&walker->getWalkMC()->getWP().leg[3].lift_vel.x));
00066     addItem(new ValueEditControl<double>("liftLeg[yFL]",&walker->getWalkMC()->getWP().leg[0].lift_vel.y));
00067     addItem(new ValueEditControl<double>("liftLeg[yFR]",&walker->getWalkMC()->getWP().leg[1].lift_vel.y));
00068     addItem(new ValueEditControl<double>("liftLeg[yBL]",&walker->getWalkMC()->getWP().leg[2].lift_vel.y));
00069     addItem(new ValueEditControl<double>("liftLeg[yBR]",&walker->getWalkMC()->getWP().leg[3].lift_vel.y));
00070     addItem(new ValueEditControl<double>("liftLeg[zFL]",&walker->getWalkMC()->getWP().leg[0].lift_vel.z));
00071     addItem(new ValueEditControl<double>("liftLeg[zFR]",&walker->getWalkMC()->getWP().leg[1].lift_vel.z));
00072     addItem(new ValueEditControl<double>("liftLeg[zBL]",&walker->getWalkMC()->getWP().leg[2].lift_vel.z));
00073     addItem(new ValueEditControl<double>("liftLeg[zBR]",&walker->getWalkMC()->getWP().leg[3].lift_vel.z));
00074   }
00075   endSubMenu();
00076   
00077   startSubMenu("down_vel","Edit the walk parameters");
00078   { 
00079     addItem(new ValueEditControl<double>("downLeg[xFL]",&walker->getWalkMC()->getWP().leg[0].down_vel.x));
00080     addItem(new ValueEditControl<double>("downLeg[xFR]",&walker->getWalkMC()->getWP().leg[1].down_vel.x));
00081     addItem(new ValueEditControl<double>("downLeg[xBL]",&walker->getWalkMC()->getWP().leg[2].down_vel.x));
00082     addItem(new ValueEditControl<double>("downLeg[xBR]",&walker->getWalkMC()->getWP().leg[3].down_vel.x));
00083     addItem(new ValueEditControl<double>("downLeg[yFL]",&walker->getWalkMC()->getWP().leg[0].down_vel.y));
00084     addItem(new ValueEditControl<double>("downLeg[yFR]",&walker->getWalkMC()->getWP().leg[1].down_vel.y));
00085     addItem(new ValueEditControl<double>("downLeg[yBL]",&walker->getWalkMC()->getWP().leg[2].down_vel.y));
00086     addItem(new ValueEditControl<double>("downLeg[yBR]",&walker->getWalkMC()->getWP().leg[3].down_vel.y));
00087     addItem(new ValueEditControl<double>("downLeg[zFL]",&walker->getWalkMC()->getWP().leg[0].down_vel.z));
00088     addItem(new ValueEditControl<double>("downLeg[zFR]",&walker->getWalkMC()->getWP().leg[1].down_vel.z));
00089     addItem(new ValueEditControl<double>("downLeg[zBL]",&walker->getWalkMC()->getWP().leg[2].down_vel.z));
00090     addItem(new ValueEditControl<double>("downLeg[zBR]",&walker->getWalkMC()->getWP().leg[3].down_vel.z));
00091   }
00092   endSubMenu();
00093   
00094   startSubMenu("lift_time","Edit the walk parameters");
00095   { 
00096     addItem(new ValueEditControl<double>("liftimeLeg[FL]",&walker->getWalkMC()->getWP().leg[0].lift_time));
00097     addItem(new ValueEditControl<double>("liftimeLeg[FR]",&walker->getWalkMC()->getWP().leg[1].lift_time));
00098     addItem(new ValueEditControl<double>("liftimeLeg[BL]",&walker->getWalkMC()->getWP().leg[2].lift_time));
00099     addItem(new ValueEditControl<double>("liftimeLeg[BR]",&walker->getWalkMC()->getWP().leg[3].lift_time));
00100   }
00101   endSubMenu();
00102   
00103   startSubMenu("down_time","Edit the walk parameters");
00104   { 
00105     addItem(new ValueEditControl<double>("downimeLeg[FL]",&walker->getWalkMC()->getWP().leg[0].down_time));
00106     addItem(new ValueEditControl<double>("downimeLeg[FR]",&walker->getWalkMC()->getWP().leg[1].down_time));
00107     addItem(new ValueEditControl<double>("downimeLeg[BL]",&walker->getWalkMC()->getWP().leg[2].down_time));
00108     addItem(new ValueEditControl<double>("downimeLeg[BR]",&walker->getWalkMC()->getWP().leg[3].down_time));
00109   }
00110   endSubMenu();
00111   
00112   startSubMenu("calibration","Edit the walk parameters");
00113   { 
00114     addItem(new WalkCalibration());
00115     addItem(new LoadCalibration(&walker->getWalkMC()->getCP()));
00116     addItem(new ValueEditControl<float>("forward max_accel",&walker->getWalkMC()->getCP().max_accel[WalkMC::CalibrationParam::forward]));
00117     addItem(new ValueEditControl<float>("reverse max_accel",&walker->getWalkMC()->getCP().max_accel[WalkMC::CalibrationParam::reverse]));
00118     addItem(new ValueEditControl<float>("strafe max_accel",&walker->getWalkMC()->getCP().max_accel[WalkMC::CalibrationParam::strafe]));
00119     addItem(new ValueEditControl<float>("rotate max_accel",&walker->getWalkMC()->getCP().max_accel[WalkMC::CalibrationParam::rotate]));
00120     addItem(new ValueEditControl<float>("forward max_vel",&walker->getWalkMC()->getCP().max_vel[WalkMC::CalibrationParam::forward]));
00121     addItem(new ValueEditControl<float>("reverse max_vel",&walker->getWalkMC()->getCP().max_vel[WalkMC::CalibrationParam::reverse]));
00122     addItem(new ValueEditControl<float>("strafe max_vel",&walker->getWalkMC()->getCP().max_vel[WalkMC::CalibrationParam::strafe]));
00123     addItem(new ValueEditControl<float>("rotate max_vel",&walker->getWalkMC()->getCP().max_vel[WalkMC::CalibrationParam::rotate]));
00124   }
00125   endSubMenu();
00126   
00127   addItem(new LoadWalkControl("Load Walk",walker->getWalkMC()));
00128   addItem(new SaveWalkControl("Save Walk",walker->getWalkMC()));
00129 #endif
00130 }
00131 
00132 void WalkEdit::startSubMenu(const std::string& nm, const std::string& desc) {
00133   ControlBase * c = new ControlBase(nm,desc);
00134   menuStack.top()->pushSlot(c);
00135   menuStack.push(c);
00136 }
00137 
00138 void WalkEdit::addItem(ControlBase* control) {
00139   menuStack.top()->pushSlot(control);
00140 }
00141 
00142 void WalkEdit::endSubMenu() {
00143   menuStack.pop();
00144 }
00145 
00146 #endif
00147 
00148 /*! @file
00149  * @brief Implements WalkEdit, which provides an editor for the CMPack-based Aibo walk engine
00150  * @author Ethan Tira-Thompson (ejt) (Creator)
00151  */

Tekkotsu v5.1CVS
Generated Mon May 9 04:58:52 2016 by Doxygen 1.6.3