From dee0d7a7133882bb3e139c69a75e77632e65a57d Mon Sep 17 00:00:00 2001 From: squeeglepoof Date: Mon, 29 Aug 2016 13:53:17 -0700 Subject: [PATCH] Round 2 of evaluating MountainGoat on the supercomputer --- scripts/learning/src/MG_SecondAttempt.json | 2 +- .../MG_SecondAttempt/AppQuadSimpleActuation.cpp | 5 +++-- .../bgigous/MG_SecondAttempt/AppQuadSimpleActuation.h | 1 + .../MG_SecondAttempt/BigPuppySymmetricSpiral2.cpp | 11 +++++++++++ .../MG_SecondAttempt/JSONQuadFeedbackControl.cpp | 9 +++++---- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/scripts/learning/src/MG_SecondAttempt.json b/scripts/learning/src/MG_SecondAttempt.json index 73c966f3f..52b83e6b9 100644 --- a/scripts/learning/src/MG_SecondAttempt.json +++ b/scripts/learning/src/MG_SecondAttempt.json @@ -36,7 +36,7 @@ "monteCarlo" : true, "numberOfStates" : 0, "numberOfOutputs" : 2, - "numberOfInstances" : 100, + "numberOfInstances" : 392, "populationSize" : 5000, "useAverage" : true, "numberToMutate" : 2, diff --git a/src/dev/bgigous/MG_SecondAttempt/AppQuadSimpleActuation.cpp b/src/dev/bgigous/MG_SecondAttempt/AppQuadSimpleActuation.cpp index bd701b075..af8c355cc 100644 --- a/src/dev/bgigous/MG_SecondAttempt/AppQuadSimpleActuation.cpp +++ b/src/dev/bgigous/MG_SecondAttempt/AppQuadSimpleActuation.cpp @@ -116,7 +116,7 @@ bool AppQuadSimpleActuation::setup() const double impedanceMax = 2000.0; const int segmentSpan = 3; //Not sure what this will be for mine! - const int numMuscles = 8; //This may be ok, but confirm. + const int numMuscles = 16; //This may be ok, but confirm. const int numParams = 2; const int segNumber = 0; // For learning results const double controlTime = .01; @@ -175,7 +175,7 @@ bool AppQuadSimpleActuation::setup() maxH, minH); /// @todo fix memory leak that occurs here - JSONQuadFeedbackControl* const myControl = + myControl = new JSONQuadFeedbackControl(control_config, suffix, lowerPath); #if (0) @@ -347,6 +347,7 @@ bool AppQuadSimpleActuation::run() delete simulation; delete view; delete world; + delete myControl; return true; } diff --git a/src/dev/bgigous/MG_SecondAttempt/AppQuadSimpleActuation.h b/src/dev/bgigous/MG_SecondAttempt/AppQuadSimpleActuation.h index 39a763f7c..12ab4dbd3 100644 --- a/src/dev/bgigous/MG_SecondAttempt/AppQuadSimpleActuation.h +++ b/src/dev/bgigous/MG_SecondAttempt/AppQuadSimpleActuation.h @@ -90,6 +90,7 @@ class AppQuadSimpleActuation tgWorld* world; tgSimView* view; tgSimulation* simulation; + JSONQuadFeedbackControl * myControl; bool use_graphics; bool add_controller; diff --git a/src/dev/bgigous/MG_SecondAttempt/BigPuppySymmetricSpiral2.cpp b/src/dev/bgigous/MG_SecondAttempt/BigPuppySymmetricSpiral2.cpp index 150d80a83..070d9b3a5 100644 --- a/src/dev/bgigous/MG_SecondAttempt/BigPuppySymmetricSpiral2.cpp +++ b/src/dev/bgigous/MG_SecondAttempt/BigPuppySymmetricSpiral2.cpp @@ -554,6 +554,17 @@ void BigPuppySymmetricSpiral2::addMuscles(tgStructure& puppy){ puppy.addPair(n6[3], n13[0], tgString("left front leg_to spine middle muscleAct seg", 11) + tgString(" seg", 7)); puppy.addPair(n0[2], n14[0], tgString("left hind leg_to spine middle muscleAct seg", 11) + tgString(" seg", 7)); + puppy.addPair(n13[5], n9[2], tgString("left front leg_to extra muscleAct seg", 13) + tgString(" seg", 9)); + puppy.addPair(n13[5], n9[3], tgString("left front leg_to extra muscleAct seg", 13) + tgString(" seg", 9)); + + puppy.addPair(n11[5], n7[2], tgString("right front leg_to inner extra muscleAct seg", 11) + tgString(" seg", 7)); + puppy.addPair(n11[5], n7[3], tgString("right front leg_to inner extra muscleAct seg", 11) + tgString(" seg", 7)); + + puppy.addPair(n12[5], n8[2], tgString("right hind leg_to extra muscleAct seg", 12) + tgString(" seg", 8)); + puppy.addPair(n12[5], n8[3], tgString("right hind leg_to extra muscleAct seg", 12) + tgString(" seg", 8)); + + puppy.addPair(n14[5], n10[2], tgString("left hind leg_to extra muscleAct seg", 14) + tgString(" seg", 10)); + puppy.addPair(n14[5], n10[3], tgString("left hind leg_to extra muscleAct seg", 14) + tgString(" seg", 10)); //puppy.addPair(n14[5], n10[2], tgString("left_hind_leg extra muscle seg", 14) + tgString(" seg", 10)); //puppy.addPair(n14[5], n10[3], tgString("left_hind_leg extra muscle seg", 14) + tgString(" seg", 10)); //Populate feet with muscles. Todo: think up names to differentiate each! diff --git a/src/dev/bgigous/MG_SecondAttempt/JSONQuadFeedbackControl.cpp b/src/dev/bgigous/MG_SecondAttempt/JSONQuadFeedbackControl.cpp index 2382e327c..42e7784d9 100644 --- a/src/dev/bgigous/MG_SecondAttempt/JSONQuadFeedbackControl.cpp +++ b/src/dev/bgigous/MG_SecondAttempt/JSONQuadFeedbackControl.cpp @@ -233,10 +233,11 @@ void JSONQuadFeedbackControl::onStep(BaseSpineModelLearning& subject, double dt) m_updateTime = 0; } - double currentHeight = subject.getSegmentCOM(m_config.segmentNumber)[1]; - - /// Max and min heights added to config - if (currentHeight > m_config.maxHeight || currentHeight < m_config.minHeight) + double currentHeight = subject.getSegmentCOM(m_config.segmentNumber)[1]; + double currentHeightTail = subject.getSegmentCOM(6)[1]; + /// Max and min heights added to config + if (currentHeight > m_config.maxHeight || currentHeight < m_config.minHeight + || currentHeightTail > m_config.maxHeight || currentHeightTail < m_config.minHeight) { /// @todo if bogus, stop trial (reset simulation) bogus = true;