int getComponentNames (ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char **argv){ // getComponentNames stateIdx trajectoryIdx if( argc != 3 ) return TCL_ERROR; ControllerEditor* obj = (ControllerEditor*)clientData; int idx = atoi( argv[1] ); SimBiConState* state = obj->getFramework()->getController()->getState( idx ); if( !state ) return TCL_ERROR; idx = atoi( argv[2] ); Trajectory* trajectory = state->getTrajectory( idx ); if( !trajectory ) return TCL_ERROR; DynamicArray<const char*> componentNames; for( uint i = 0; i < trajectory->components.size(); ++i ) { char* componentName = new char[ 32 ]; sprintf( componentName, "Component %d", i ); componentNames.push_back( componentName ); } char* result = stringListToTclList( componentNames ); for( uint i = 0; i < componentNames.size(); ++i ) delete[] componentNames[i]; Tcl_SetResult(interp, result, TCL_DYNAMIC); return TCL_OK; }
int trajectoryToEdit(ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char **argv){ // selectCurveToEdit stateIdx trajectoryIdx if( argc != 3 ) return TCL_ERROR; ControllerEditor* obj = (ControllerEditor*)clientData; int idx = atoi( argv[1] ); SimBiConState* state = obj->getFramework()->getController()->getState( idx ); if( !state ) return TCL_ERROR; idx = atoi( argv[2] ); Trajectory* trajectory = state->getTrajectory( idx ); if( !trajectory ) return TCL_ERROR; obj->clearEditedCurves(); for( uint i = 0; i < trajectory->components.size(); ++i ) { obj->addEditedCurve( &trajectory->components[i]->baseTraj ); } if( trajectory->strengthTraj != NULL ) { obj->addEditedCurve( trajectory->strengthTraj ); } return TCL_OK; }
int getTrajectoryNames (ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char **argv){ // getComponentNames stateIdx if( argc != 2 ) return TCL_ERROR; ControllerEditor* obj = (ControllerEditor*)clientData; int idx = atoi( argv[1] ); SimBiConState* state = obj->getFramework()->getController()->getState( idx ); if( !state ) return TCL_ERROR; DynamicArray<const char*> trajectoryNames; for( int i = 0; i < state->getTrajectoryCount(); ++i ) { Trajectory* trajectory = state->getTrajectory( i ); trajectoryNames.push_back( trajectory->jName ); } char* result = stringListToTclList( trajectoryNames ); Tcl_SetResult(interp, result, TCL_DYNAMIC); return TCL_OK; }
/** this method is used to set the offsets for any and all components of trajectories.. */ void BipV3BalanceController::applyTrajectoryOffsets(){ // return; //huge hack for now... SimBiConState* curState = standingBalanceController->states[con->FSMStateIndex]; Trajectory* tmpTraj; SimGlobals::rootSagittal = SimGlobals::stanceKnee / 10.0; tmpTraj = curState->getTrajectory("root"); tmpTraj->components[2]->offset = SimGlobals::rootSagittal; tmpTraj = curState->getTrajectory("pelvis_lowerback"); tmpTraj->components[2]->offset = SimGlobals::rootSagittal*1.5; tmpTraj = curState->getTrajectory("lowerback_torso"); tmpTraj->components[2]->offset = SimGlobals::rootSagittal*2; tmpTraj = curState->getTrajectory("torso_head"); tmpTraj->components[2]->offset = SimGlobals::rootSagittal*2.1; /* tmpTraj = curState->getTrajectory("root"); tmpTraj->components[0]->offset = SimGlobals::rootSagittal; tmpTraj = curState->getTrajectory("pelvis_lowerback"); tmpTraj->components[0]->offset = SimGlobals::rootSagittal*1.5; tmpTraj = curState->getTrajectory("lowerback_torso"); tmpTraj->components[0]->offset = SimGlobals::rootSagittal*2; tmpTraj = curState->getTrajectory("torso_head"); tmpTraj->components[0]->offset = SimGlobals::rootSagittal*3; */ /* tmpTraj = curState->getTrajectory("root"); tmpTraj->components[1]->offset = SimGlobals::rootSagittal; tmpTraj = curState->getTrajectory("pelvis_lowerback"); tmpTraj->components[1]->offset = SimGlobals::rootSagittal*1.5; tmpTraj = curState->getTrajectory("lowerback_torso"); tmpTraj->components[1]->offset = SimGlobals::rootSagittal*2; tmpTraj = curState->getTrajectory("torso_head"); tmpTraj->components[1]->offset = SimGlobals::rootSagittal*3; */ tmpTraj = curState->getTrajectory("STANCE_Knee"); tmpTraj->components[0]->offset = SimGlobals::stanceKnee; tmpTraj = curState->getTrajectory("SWING_Knee"); tmpTraj->components[0]->offset = SimGlobals::stanceKnee; /* tmpTraj = curState->getTrajectory("SWING_Hip"); tmpTraj->components[0]->offset = SimGlobals::swingHipSagittal; // tmpTraj = curState->getTrajectory("root"); // tmpTraj->components[0]->offset = SimGlobals::swingHipSagittal; // tmpTraj->components[1]->offset = SimGlobals::swingHipLateral; // tmpTraj = curState->getTrajectory("STANCE_Hip"); // tmpTraj->components[0]->offset = 0; // tmpTraj->components[1]->offset = 0; // tmpTraj = curState->getTrajectory("STANCE_Ankle"); // tmpTraj->components[0]->offset = SimGlobals::stanceAngleSagittal; // tmpTraj->components[1]->offset = SimGlobals::stanceAngleLateral; // tmpTraj = curState->getTrajectory("SWING_Ankle"); // tmpTraj->components[0]->offset = 0; // tmpTraj->components[1]->offset = 0; tmpTraj = curState->getTrajectory("STANCE_Knee"); tmpTraj->components[0]->offset = SimGlobals::stanceKnee; tmpTraj = curState->getTrajectory("SWING_Knee"); tmpTraj->components[0]->offset = SimGlobals::stanceKnee; */ }