Skip to content

Commit 378c69d

Browse files
author
Doug Stephen
committed
Add logic to test so that it ends when the robot is done walking.
Also remove some sysouts.
1 parent 9c65776 commit 378c69d

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

IHMCAvatarInterfaces/src/us/ihmc/avatar/networkProcessor/footstepPlanningToolboxModule/FootstepPlanningToolboxController.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,6 @@ private FootstepPlanningToolboxOutputStatus packResult(FootstepPlan footstepPlan
305305
}
306306
else
307307
{
308-
System.out.println("Found a plan!");
309308
if (planarRegionsList.isPresent())
310309
{
311310
PrintTools.debug(this, "Planar regions present. Assembling footstep data list message");

IHMCAvatarInterfaces/test/us/ihmc/avatar/roughTerrainWalking/AvatarBipedalFootstepPlannerEndToEndTest.java

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import us.ihmc.avatar.initialSetup.OffsetAndYawRobotInitialSetup;
1010
import us.ihmc.avatar.networkProcessor.DRCNetworkModuleParameters;
1111
import us.ihmc.avatar.testTools.DRCSimulationTestHelper;
12+
import us.ihmc.commons.PrintTools;
1213
import us.ihmc.communication.net.PacketConsumer;
1314
import us.ihmc.communication.packetCommunicator.PacketCommunicator;
1415
import us.ihmc.communication.packets.PlanarRegionMessageConverter;
@@ -27,6 +28,7 @@
2728
import us.ihmc.graphicsDescription.yoGraphics.YoGraphicsListRegistry;
2829
import us.ihmc.humanoidRobotics.communication.packets.walking.FootstepPlanningRequestPacket;
2930
import us.ihmc.humanoidRobotics.communication.packets.walking.FootstepPlanningToolboxOutputStatus;
31+
import us.ihmc.humanoidRobotics.communication.packets.walking.WalkingStatusMessage;
3032
import us.ihmc.humanoidRobotics.communication.subscribers.HumanoidRobotDataReceiver;
3133
import us.ihmc.humanoidRobotics.kryo.IHMCCommunicationKryoNetClassList;
3234
import us.ihmc.robotModels.FullHumanoidRobotModel;
@@ -69,6 +71,8 @@ public abstract class AvatarBipedalFootstepPlannerEndToEndTest implements MultiR
6971
public static final double CINDER_BLOCK_HEIGHT_VARIATION = 0.1;
7072
public static final double CINDER_BLOCK_FIELD_PLATFORM_LENGTH = 0.6;
7173

74+
private volatile boolean planCompleted = false;
75+
7276
@Before
7377
public void setup()
7478
{
@@ -86,6 +90,7 @@ public void setup()
8690
FullHumanoidRobotModel fullHumanoidRobotModel = getRobotModel().createFullRobotModel();
8791
ForceSensorDataHolder forceSensorDataHolder = new ForceSensorDataHolder(Arrays.asList(fullHumanoidRobotModel.getForceSensorDefinitions()));
8892
humanoidRobotDataReceiver = new HumanoidRobotDataReceiver(fullHumanoidRobotModel, forceSensorDataHolder);
93+
planCompleted = false;
8994
}
9095

9196
@After
@@ -97,6 +102,7 @@ public void tearDown()
97102
toolboxCommunicator.closeConnection();
98103
toolboxCommunicator.disconnect();
99104
toolboxCommunicator = null;
105+
planCompleted = false;
100106
}
101107

102108
@ContinuousIntegrationAnnotations.ContinuousIntegrationTest(estimatedDuration = 0.0)
@@ -125,13 +131,13 @@ public void testSteppingStones() throws IOException
125131
@Override
126132
public void receivedPacket(FootstepPlanningToolboxOutputStatus packet)
127133
{
128-
System.out.println("Received result from planner: " + packet.planningResult.name());
129134
outputStatus.set(packet);
130135
}
131136
});
132137

133138
drcSimulationTestHelper.getControllerCommunicator().connect();
134139
drcSimulationTestHelper.getControllerCommunicator().attachListener(RobotConfigurationData.class, humanoidRobotDataReceiver);
140+
drcSimulationTestHelper.getControllerCommunicator().attachListener(WalkingStatusMessage.class, this::listenForWalkingComplete);
135141

136142
BlockingSimulationRunner blockingSimulationRunner = drcSimulationTestHelper.getBlockingSimulationRunner();
137143
ToolboxStateMessage wakeUpMessage = new ToolboxStateMessage(ToolboxStateMessage.ToolboxState.WAKE_UP);
@@ -189,17 +195,21 @@ public void receivedPacket(FootstepPlanningToolboxOutputStatus packet)
189195
}
190196
}
191197

198+
planCompleted = false;
192199
if(outputStatus.get().footstepDataList.size() > 0)
193200
{
194201
drcSimulationTestHelper.send(outputStatus.get().footstepDataList);
195202

196-
try
197-
{
198-
blockingSimulationRunner.simulateAndBlockAndCatchExceptions(45.0);
199-
}
200-
catch(BlockingSimulationRunner.SimulationExceededMaximumTimeException e)
203+
while(!planCompleted)
201204
{
202-
fail();
205+
try
206+
{
207+
blockingSimulationRunner.simulateAndBlockAndCatchExceptions(1.0);
208+
}
209+
catch(BlockingSimulationRunner.SimulationExceededMaximumTimeException e)
210+
{
211+
fail();
212+
}
203213
}
204214
}
205215

@@ -240,4 +250,12 @@ private CommonAvatarEnvironmentInterface createSteppingStonesEnvironment()
240250
return new PlanarRegionsListDefinedEnvironment("cinderBlockFieldEnvironment", cinderBlockField,
241251
allowablePenetrationThickness, generateGroundPlane);
242252
}
253+
254+
private void listenForWalkingComplete(WalkingStatusMessage walkingStatusMessage)
255+
{
256+
if(walkingStatusMessage.status == WalkingStatusMessage.Status.COMPLETED)
257+
{
258+
planCompleted = true;
259+
}
260+
}
243261
}

0 commit comments

Comments
 (0)