@After
  public void tearDown() {
    conductor = null;
    variables = null;

    MemoryTools.printCurrentMemoryUsageAndReturnUsedMemoryInMB(
        getClass().getSimpleName() + " after test.");
  }
  @Before
  public void setup() {
    try {
      MemoryTools.printCurrentMemoryUsageAndReturnUsedMemoryInMB(
          getClass().getSimpleName() + " before test.");
      ParameterRegistry.destroyAndRecreateInstance();

      QuadrupedTestFactory quadrupedTestFactory = createQuadrupedTestFactory();
      quadrupedTestFactory.setControlMode(QuadrupedControlMode.POSITION);
      quadrupedTestFactory.setGroundContactModelType(QuadrupedGroundContactModelType.FLAT);
      conductor = quadrupedTestFactory.createTestConductor();
      variables = new QuadrupedPositionTestYoVariables(conductor.getScs());
    } catch (IOException e) {
      throw new RuntimeException("Error loading simulation: " + e.getMessage());
    }
  }
  @Before
  public void setUp() {
    MemoryTools.printCurrentMemoryUsageAndReturnUsedMemoryInMB(
        getClass().getSimpleName() + " before test.");

    behaviorCommunicatorServer =
        PacketCommunicator.createIntraprocessPacketCommunicator(
            NetworkPorts.BEHAVIOUR_MODULE_PORT, new IHMCCommunicationKryoNetClassList());
    behaviorCommunicatorClient =
        PacketCommunicator.createIntraprocessPacketCommunicator(
            NetworkPorts.BEHAVIOUR_MODULE_PORT, new IHMCCommunicationKryoNetClassList());
    try {
      behaviorCommunicatorClient.connect();
      behaviorCommunicatorServer.connect();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    drcSimulationTestHelper =
        new DRCSimulationTestHelper(
            testEnvironment,
            getSimpleRobotName(),
            DRCObstacleCourseStartingLocation.DEFAULT,
            simulationTestingParameters,
            getRobotModel());

    Robot robotToTest = drcSimulationTestHelper.getRobot();
    yoTime = robotToTest.getYoTime();

    robot = drcSimulationTestHelper.getRobot();
    fullRobotModel = getRobotModel().createFullRobotModel();

    forceSensorDataHolder =
        new ForceSensorDataHolder(Arrays.asList(fullRobotModel.getForceSensorDefinitions()));
    robotDataReceiver = new HumanoidRobotDataReceiver(fullRobotModel, forceSensorDataHolder);

    drcSimulationTestHelper.attachListener(RobotConfigurationData.class, robotDataReceiver);

    PacketRouter<PacketDestination> networkProcessor = new PacketRouter<>(PacketDestination.class);
    networkProcessor.attachPacketCommunicator(
        PacketDestination.CONTROLLER, drcSimulationTestHelper.getControllerCommunicator());
    networkProcessor.attachPacketCommunicator(
        PacketDestination.BEHAVIOR_MODULE, behaviorCommunicatorClient);

    communicationBridge =
        new BehaviorCommunicationBridge(
            behaviorCommunicatorServer, robotToTest.getRobotsYoVariableRegistry());
  }
  @After
  public void destroySimulationAndRecycleMemory() {
    if (simulationTestingParameters.getKeepSCSUp()) {
      ThreadTools.sleepForever();
    }

    // Do this here in case a test fails. That way the memory will be recycled.
    if (drcFlatGroundWalkingTrack != null) {
      drcFlatGroundWalkingTrack.destroySimulation();
      drcFlatGroundWalkingTrack = null;
    }

    if (blockingSimulationRunner != null) {
      blockingSimulationRunner.destroySimulation();
      blockingSimulationRunner = null;
    }

    pushRobotController = null;
    doubleSupportStartConditions = null;
    pushCondition = null;
    MemoryTools.printCurrentMemoryUsageAndReturnUsedMemoryInMB(
        getClass().getSimpleName() + " after test.");
  }
  @After
  public void destroySimulationAndRecycleMemory() {
    if (simulationTestingParameters.getKeepSCSUp()) {
      ThreadTools.sleepForever();
    }

    // Do this here in case a test fails. That way the memory will be recycled.
    if (drcSimulationTestHelper != null) {
      drcSimulationTestHelper.destroySimulation();
      drcSimulationTestHelper = null;
    }

    if (behaviorCommunicatorClient != null) {
      behaviorCommunicatorClient.close();
    }

    if (behaviorCommunicatorServer != null) {
      behaviorCommunicatorServer.close();
    }

    MemoryTools.printCurrentMemoryUsageAndReturnUsedMemoryInMB(
        getClass().getSimpleName() + " after test.");
  }
 @Before
 public void showMemoryUsageBeforeTest() {
   MemoryTools.printCurrentMemoryUsageAndReturnUsedMemoryInMB(
       getClass().getSimpleName() + " before test.");
 }
 @After
 public void showMemoryUsageAfterTest() {
   MemoryTools.printCurrentMemoryUsageAndReturnUsedMemoryInMB(
       getClass().getSimpleName() + " after test.");
 }