Пример #1
0
def log_bumper_pressions(request, dcm, mem, system, wait_time_bumpers):
    """
       If one or more bumpers are pressed,
       it saves wheels' speeds [rad/s]
    """
    wheel_fr_speed_sensor = subdevice.WheelSpeedSensor(dcm, mem, "WheelFR")
    wheel_fl_speed_sensor = subdevice.WheelSpeedSensor(dcm, mem, "WheelFL")
    wheel_b_speed_sensor = subdevice.WheelSpeedSensor(dcm, mem, "WheelB")

    bumper_right = subdevice.Bumper(dcm, mem, "FrontRight")
    bumper_left = subdevice.Bumper(dcm, mem, "FrontLeft")
    bumper_back = subdevice.Bumper(dcm, mem, "Back")

    list_bumpers = [bumper_right, bumper_left, bumper_back]

    file_extension = "csv"
    robot_name = system.robotName()
    date = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
    log_type = "wheels_speeds_when_bumper_pressions"
    file_name = "-".join([robot_name, date, log_type])
    output = ".".join([file_name, file_extension])

    data = open(output, 'w')
    data.write("Bumper FR" + "," + "Bumper FL" + "," + "Bumper B" + "," +
               "wheel FR speed [rad/s]" + "," + "wheel FL speed [rad/s]" +
               "," + "Wheel B speed [rad/s]" + "\n")
    data.flush()

    threading_flag = threading.Event()

    def log(threading_flag):
        while not threading_flag.is_set():
            line = ""
            flag = 0
            speed_fr = wheel_fr_speed_sensor.value
            speed_fl = wheel_fl_speed_sensor.value
            speed_b = wheel_b_speed_sensor.value
            for bumper in list_bumpers:
                if bumper.value == 1:
                    flag += 1
                    line += str(1) + ","
                else:
                    line += str(0) + ","
            if flag > 0:
                line += str(speed_fr) + "," + \
                        str(speed_fl) + "," + \
                        str(speed_b) + "\n"
                data.write(line)
                data.flush()
            tools.wait(dcm, wait_time_bumpers)

    log_thread = threading.Thread(target=log, args=(threading_flag, ))
    log_thread.start()

    def fin():
        threading_flag.set()

    request.addfinalizer(fin)
Пример #2
0
def test_reliability_003(dcm, mem, motion, motion_wake_up, parameters,
                         direction):
    """
    Test : bumper detects step.
    Return True if bumper detects obstacles and robot stops
    Return False if bumper detects obstacle but robot moves again

    @dcm                : proxy to DCM (object)
    @mem                : proxy to ALMemory (object)
    @motion             : proxy to ALMotion (object)
    @motion_wake_up     : robot does it wakeUp
    @parameters         : dictionnary {"parameter":value} from config file
                            (dictionnary)
    @directions         : dictionnary {"direction":value} (dictionnary)
    """
    # Objects creation
    right_bumper = subdevice.Bumper(dcm, mem, "FrontRight")
    left_bumper = subdevice.Bumper(dcm, mem, "FrontLeft")
    back_bumper = subdevice.Bumper(dcm, mem, "Back")
    wheelfr_speed_act = subdevice.WheelSpeedActuator(dcm, mem, "WheelFR")
    wheelfl_speed_act = subdevice.WheelSpeedActuator(dcm, mem, "WheelFL")

    log = Log(dcm, mem, direction + "-" + parameters["Speed"][0])
    log.start()

    print "Go move"
    move(
        motion, float(parameters["Speed"][0]),
        qha_tools.read_section("reliability_003.cfg", "Direction" + direction))
    print "Move finish"

    flag = 0
    while flag < int(parameters["Nbcycles"][0]):
        if right_bumper.value or left_bumper.value or back_bumper.value:
            print "Bumper"
            time.sleep(3)  # Time to wait wheel actuators reaction...
            if wheelfr_speed_act.value == 0 and wheelfl_speed_act.value == 0:
                print "Stop OK"
                flag += 1
                time.sleep(5)  # Robot forget mapping
                moveto(
                    motion, float(parameters["MoveBackDistance"][0]),
                    qha_tools.read_section("reliability_003.cfg",
                                           "Direction" + direction))
                print "Move back OK"
                time.sleep(2)
                move(
                    motion, float(parameters["Speed"][0]),
                    qha_tools.read_section("reliability_003.cfg",
                                           "Direction" + direction))
                print "Move"
            else:
                print flag
                break

    log.stop()

    assert flag == int(parameters["Nbcycles"][0])
Пример #3
0
    def run(self):
        bumper_right = subdevice.Bumper(self.dcm, self.mem, "FrontRight")
        bumper_left = subdevice.Bumper(self.dcm, self.mem, "FrontLeft")
        bumper_back = subdevice.Bumper(self.dcm, self.mem, "Back")

        list_bumpers = [bumper_right, bumper_left, bumper_back]

        parameters = tools.read_section("config.cfg",
                                        "BumpersActivationsParameters")

        # If file already exists, reading to know the previous state
        if os.path.exists(parameters["Log_file_name"][0]):
            data = open(parameters["Log_file_name"][0], 'r')
            csv_reader = csv.reader(data)
            variables_list = []
            row_num = 0
            for row in csv_reader:
                data_num = 0
                if row_num == 0:
                    for value in row:
                        variables_list.append([value])
                else:
                    for value in row:
                        variables_list[data_num].append(value)
                        data_num += 1
                row_num += 1
            self._bumpers_activations = int(variables_list[0][row_num - 1])
            previous_time = float(variables_list[1][row_num - 1])
            data.close()
            data = open(parameters["Log_file_name"][0], 'a')
        # Else initialize to 0
        else:
            self._bumpers_activations = 0
            previous_time = 0.
            data = open(parameters["Log_file_name"][0], 'w')
            data.write("Bumpers activations,Time\n0,0\n")
            data.flush()

        time_init = time.time()

        # Loop
        while not self._stop.is_set():
            for bumper in list_bumpers:
                if bumper.value == 1:
                    self._bumpers_activations += 1
                    data.write(str(self._bumpers_activations) + "," + \
                               str(time.time() - time_init + previous_time) + "\n")
                    print("nb of bumpers activations: " +
                          str(self._bumpers_activations) + "\n")
                    data.flush()
            tools.wait(self.dcm, 2 * self.wait_time_bumpers)
Пример #4
0
    def __init__(self, dcm, mem, file_name):
        """
        @dcm                    : proxy to DCM (object)
        @mem                    : proxy to ALMemory (object)
        @file_name              : name of log file (string)
        """

        threading.Thread.__init__(self)
        self._mem = mem
        self._file_name = file_name

        self._wheelb_speed_act = subdevice.WheelSpeedActuator(
            dcm, mem, "WheelB")
        self._wheelfr_speed_act = subdevice.WheelSpeedActuator(
            dcm, mem, "WheelFR")
        self._wheelfl_speed_act = subdevice.WheelSpeedActuator(
            dcm, mem, "WheelFL")
        self._rightbumper = subdevice.Bumper(dcm, mem, "FrontRight")
        self._leftbumper = subdevice.Bumper(dcm, mem, "FrontLeft")

        self._end = False
Пример #5
0
 def __init__(self, dcm, mem):
     """
     Initialisation de la class
     """
     self.dcm = dcm
     self.mem = mem
     self.parameters = qha_tools.read_section("test_config.cfg",
                                              "DockCyclingParameters")
     self.wheel_motion = subdevice.WheelsMotion(
         self.dcm, self.mem, float(self.parameters["speed"][0]))
     self.robot_on_charging_station = subdevice.ChargingStationSensor(
         self.dcm, self.mem)
     self.back_bumper_sensor = subdevice.Bumper(dcm, mem, "Back")
     self.nb_cycles = self.parameters["nb_cycles"][0]
     self.log_file = open(self.parameters["cycling_cvs_name"][0], 'w')
     self.check_temperature_thread = threading.Thread(
         target=self._check_temperature_thread, args=())
     self.check_bumper_thread = threading.Thread(
         target=self._check_bumper_thread, args=())
     self.check_bumper = True
     self.check_bumper_pause = True
     self.check_temperature = None
     self.wheel_hot = None
     self.bumper_state = None
Пример #6
0
def test_move_random(dcm, mem, leds, expressiveness, wait_time,
                     wait_time_bumpers, min_fraction, max_fraction, max_random,
                     stop_robot, wake_up_pos_brakes_closed, stiff_robot_wheels,
                     unstiff_joints, log_wheels_speed, log_bumper_pressions):

    #---------------------------------------------------------#
    #-------------------- Object creations -------------------#
    #---------------------------------------------------------#

    #------------------------- Wheels ------------------------#

    list_wheel_speed_actuator = [
        subdevice.WheelSpeedActuator(dcm, mem, "WheelFR"),
        subdevice.WheelSpeedActuator(dcm, mem, "WheelFL"),
        subdevice.WheelSpeedActuator(dcm, mem, "WheelB")
    ]

    list_wheel_speed_sensor = [
        subdevice.WheelSpeedSensor(dcm, mem, "WheelFR"),
        subdevice.WheelSpeedSensor(dcm, mem, "WheelFL"),
        subdevice.WheelSpeedSensor(dcm, mem, "WheelB")
    ]

    list_wheel_stiffness_actuator = [
        subdevice.WheelStiffnessActuator(dcm, mem, "WheelFR"),
        subdevice.WheelStiffnessActuator(dcm, mem, "WheelFL"),
        subdevice.WheelStiffnessActuator(dcm, mem, "WheelB")
    ]

    list_wheel_temperature = [
        subdevice.WheelTemperatureSensor(dcm, mem, "WheelFR"),
        subdevice.WheelTemperatureSensor(dcm, mem, "WheelFL"),
        subdevice.WheelTemperatureSensor(dcm, mem, "WheelB")
    ]

    #------------------------- Bumpers -----------------------#

    list_bumper = [
        subdevice.Bumper(dcm, mem, "FrontRight"),
        subdevice.Bumper(dcm, mem, "FrontLeft"),
        subdevice.Bumper(dcm, mem, "Back")
    ]

    #-------------------------- Leds --------------------------#

    # Disable notifications (from disconnected tablet)
    expressiveness._setNotificationEnabled(False)

    # Switch off eyes and ears leds
    leds.off('FaceLeds')
    leds.off('EarLeds')

    # Switch on shoulder leds
    leds.createGroup("shoulder_group", SHOULDER_LEDS)
    leds.on("shoulder_group")

    # Bumpers activation detection
    parameters_bumpers = tools.read_section("config.cfg",
                                            "BumpersActivationsParameters")

    # Launch bumper counter (thread)
    bumper_detection = mobile_base_utils.BumpersCounting(
        dcm, mem, leds, wait_time_bumpers)
    bumper_detection.start()

    #---------------------------------------------------------#
    #--------------------- Initialization --------------------#
    #---------------------------------------------------------#
    flag_bumpers = False
    list_commands = move_robot_random(dcm, mem, wait_time, min_fraction,
                                      max_fraction, max_random)
    tools.wait(dcm, 2000)

    #---------------------------------------------------------#
    #----------------------- Main Loop -----------------------#
    #---------------------------------------------------------#
    while flag_bumpers == False:

        try:
            #-------------------- Wall event -------------------#
            if (list_bumper[0].value == 1) or \
               (list_bumper[1].value == 1) or \
               (list_bumper[2].value == 1):

                # Robot hit wall --> Stop it
                list_wheel_speed_actuator[0].qvalue = (0.0, 0)
                list_wheel_speed_actuator[1].qvalue = (0.0, 0)
                list_wheel_speed_actuator[2].qvalue = (0.0, 0)

                # Going back
                list_wheel_speed_actuator[0].qvalue = [
                    (-1) * list_commands[0][0][0], wait_time
                ]
                list_wheel_speed_actuator[1].qvalue = [
                    (-1) * list_commands[1][0][0], wait_time
                ]
                list_wheel_speed_actuator[2].qvalue = [
                    (-1) * list_commands[2][0][0], wait_time
                ]

                tools.wait(dcm, 4000)

                # random again
                list_commands = move_robot_random(dcm, mem, wait_time,
                                                  min_fraction, max_fraction,
                                                  max_random)

                #tools.wait(dcm, 2000)

            #--------------------- Check temperatures --------------------#
            check_wheel_temperatures(dcm, leds, list_wheel_temperature,
                                     list_wheel_speed_actuator,
                                     list_wheel_stiffness_actuator)

            #-------------------- Check test variables -------------------#
            if bumper_detection.bumpers_activations == \
                    int(parameters_bumpers["nb_bumper_activations"][0]):
                bumper_detection.stop()
                flag_bumpers = True

        # Exit test if user interrupt
        except KeyboardInterrupt:
            print "\n******* User interrupt - ending test *******"
            bumper_detection.stop()
            break
Пример #7
0
def test_damage(dcm, mem, kill_motion):
    """
    Test robot docking/undocking to check damages
    """
    time.sleep(10)
    # Test parameters
    parameters = qha_tools.read_section("test_pod.cfg",
                                        "DockCyclingParameters")

    # Objects creation
    motion = subdevice.WheelsMotion(dcm, mem, float(parameters["speed"][0]))

    robot_on_charging_station = subdevice.ChargingStationSensor(dcm, mem)
    wheelfr_temperature_sensor = subdevice.WheelTemperatureSensor(
        dcm, mem, "WheelFR")
    wheelfl_temperature_sensor = subdevice.WheelTemperatureSensor(
        dcm, mem, "WheelFL")
    back_bumper_sensor = subdevice.Bumper(dcm, mem, "Back")

    # Internal flags
    cycles_done = 0
    cycles_with_bumper_ok = 0
    list_bumper_nok = []
    unlock_bumper_status = 0
    bumper_blocked_flag = False
    detection = 1
    loose_connexion_flag = 0
    stop_cycling_flag = False

    # Flag initialization
    flag_detection = True
    flag_bumper = True
    flag_keep_connexion = True

    timer = qha_tools.Timer(dcm, 10)
    log_file = open(parameters["cycling_cvs_name"][0], 'w')
    log_file.write(
        "CyclesDone,CyclesDoneWithBumperOk," +
        "Detection,LooseConnection,UnlockBumperStatus,LockBumperStatus\n")

    plot_log = Plot(dcm, mem, parameters["easy_plot_csv_name"][0])
    plot_log.start()

    # Cyclage
    # If the robot is not on the pod or bumper not activated, test don't start
    if robot_on_charging_station.value == 0:
        print "Put the robot on the pod\n"
        stop_cycling_flag = True
        flag_detection = False
        flag_bumper = False
        flag_keep_connexion = False

    while stop_cycling_flag == False:
        # Robot moves front
        cycles_done += 1
        motion.move_x(float(parameters["distance_front"][0]))
        qha_tools.wait(dcm, int(parameters["time_wait_out_the_pod"][0]) * 1000)
        unlock_bumper_status = back_bumper_sensor.value
        # Verification of bumper
        if back_bumper_sensor.value == 1:
            bumper_blocked_flag = True
        else:
            bumper_blocked_flag = False

        # Robot moves back
        motion.move_x(float(parameters["distance_back"][0]))
        motion.stiff_wheels(["WheelFR", "WheelFL", "WheelB"],
                            float(parameters["stiffness_wheels_value"][0]))
        qha_tools.wait(
            dcm,
            float(parameters["time_wait_before_verify_detection"][0]) * 1000)
        # Verification of connexion
        t_init = timer.dcm_time()
        test_time = 0
        while robot_on_charging_station.value == 1 and\
                test_time < int(parameters["time_wait_on_the_pod"][0]) * 1000:
            detection = 1
            loose_connexion_flag = 0
            test_time = timer.dcm_time() - t_init
        # If no detection
        if test_time == 0:
            detection = 0
        # If connexion is lost
        elif test_time < int(parameters["time_wait_on_the_pod"][0]) * 1000:
            loose_connexion_flag = 1
            flag_keep_connexion = False
        # Verification of bumper
        if back_bumper_sensor.value == 1 and bumper_blocked_flag == False:
            cycles_with_bumper_ok += 1
        else:
            list_bumper_nok.append(cycles_done)

        # Log data
        line_to_write = ",".join([
            str(cycles_done),
            str(cycles_with_bumper_ok),
            str(detection),
            str(loose_connexion_flag),
            str(unlock_bumper_status),
            str(back_bumper_sensor.value)
        ])
        line_to_write += "\n"
        log_file.write(line_to_write)
        log_file.flush()

        # Wait if temperature of wheels too hot
        while wheelfr_temperature_sensor.value > \
                int(parameters["wheels_temperature_limit"][0]) or\
                wheelfl_temperature_sensor.value > \
                int(parameters["wheels_temperature_limit"][0]):
            qha_tools.wait(dcm, int(parameters["time_wait_wheels cooled"][0]))

        # End if nb_cycles is reached
        if cycles_done == int(parameters["nb_cycles"][0]):
            stop_cycling_flag = True

    if len(list_bumper_nok) > cycles_done / 100:
        flag_bumper = False

    log_file.close()
    plot_log.stop()
    print("Cycles done = " + str(cycles_done))
    print("Cycles done with bumper ok = " + str(cycles_with_bumper_ok))

    assert flag_detection
    assert flag_bumper
    assert flag_keep_connexion
Пример #8
0
    def run(self):
        """ Log """
        robot_on_charging_station = subdevice.ChargingStationSensor(
            self.dcm, self.mem)
        battery_current = subdevice.BatteryCurrentSensor(self.dcm, self.mem)

        back_bumper_sensor = subdevice.Bumper(self.dcm, self.mem, "Back")

        wheelfr_speed_actuator = subdevice.WheelSpeedActuator(
            self.dcm, self.mem, "WheelFR")
        wheelfl_speed_actuator = subdevice.WheelSpeedActuator(
            self.dcm, self.mem, "WheelFL")
        wheelfr_speed_sensor = subdevice.WheelSpeedSensor(
            self.dcm, self.mem, "WheelFR")
        wheelfl_speed_sensor = subdevice.WheelSpeedSensor(
            self.dcm, self.mem, "WheelFL")
        wheelfr_current_sensor = subdevice.WheelCurrentSensor(
            self.dcm, self.mem, "WheelFR")
        wheelfl_current_sensor = subdevice.WheelCurrentSensor(
            self.dcm, self.mem, "WheelFL")

        log_file = open(self.file_name, 'w')
        log_file.write(
            "Time,Detection,Current,BackBumper,WheelFRSpeedActuator," +
            "WheelFRSpeedSensor,WheelFRCurrent,WheelFLSpeedActuator," +
            "WheelFLSpeedSensor,WheelFLCurrent\n")

        plot_server = easy_plot_connection.Server()

        time_init = time.time()
        while not self._end_plot:
            elapsed_time = time.time() - time_init

            plot_server.add_point("Detection", elapsed_time,
                                  robot_on_charging_station.value)
            plot_server.add_point("Current", elapsed_time,
                                  battery_current.value)
            plot_server.add_point("BackBumper", elapsed_time,
                                  back_bumper_sensor.value)
            plot_server.add_point("WheelFRSpeedActuator", elapsed_time,
                                  wheelfr_speed_actuator.value)
            plot_server.add_point("WheelFRSpeedSensor", elapsed_time,
                                  wheelfr_speed_sensor.value)

            line_to_write = ",".join([
                str(elapsed_time),
                str(robot_on_charging_station.value),
                str(battery_current.value),
                str(back_bumper_sensor.value),
                str(wheelfr_speed_actuator.value),
                str(wheelfr_speed_sensor.value),
                str(wheelfr_current_sensor.value),
                str(wheelfl_speed_actuator.value),
                str(wheelfl_speed_sensor.value),
                str(wheelfl_current_sensor.value)
            ])
            line_to_write += "\n"
            log_file.write(line_to_write)
            log_file.flush()

            time.sleep(0.1)
Пример #9
0
def test_move_random(motion, dcm, mem, leds, expressiveness, wait_time,
                     wait_time_bumpers, min_fraction, max_fraction, max_random,
                     stop_robot, wakeup_no_rotation, stiff_robot_wheels,
                     unstiff_joints, log_wheels_speed, log_bumper_pressions):

    #---------------------------------------------------------#
    #-------------------- Object creations -------------------#
    #---------------------------------------------------------#

    #------------------------- Wheels ------------------------#

    list_wheel_speed_actuator = [
        subdevice.WheelSpeedActuator(dcm, mem, "WheelFR"),
        subdevice.WheelSpeedActuator(dcm, mem, "WheelFL"),
        subdevice.WheelSpeedActuator(dcm, mem, "WheelB")
    ]

    list_wheel_speed_sensor = [
        subdevice.WheelSpeedSensor(dcm, mem, "WheelFR"),
        subdevice.WheelSpeedSensor(dcm, mem, "WheelFL"),
        subdevice.WheelSpeedSensor(dcm, mem, "WheelB")
    ]

    list_wheel_stiffness_actuator = [
        subdevice.WheelStiffnessActuator(dcm, mem, "WheelFR"),
        subdevice.WheelStiffnessActuator(dcm, mem, "WheelFL"),
        subdevice.WheelStiffnessActuator(dcm, mem, "WheelB")
    ]

    list_wheel_temperature = [
        subdevice.WheelTemperatureSensor(dcm, mem, "WheelFR"),
        subdevice.WheelTemperatureSensor(dcm, mem, "WheelFL"),
        subdevice.WheelTemperatureSensor(dcm, mem, "WheelB")
    ]

    #------------------------- Bumpers -----------------------#

    list_bumper = [
        subdevice.Bumper(dcm, mem, "FrontRight"),
        subdevice.Bumper(dcm, mem, "FrontLeft"),
        subdevice.Bumper(dcm, mem, "Back")
    ]

    #-------------------------- Leds --------------------------#

    # Disable notifications (from disconnected tablet)
    expressiveness._setNotificationEnabled(False)
    motion.setExternalCollisionProtectionEnabled('All', False)

    # Switch off eyes and ears leds
    leds.off('FaceLeds')
    leds.off('EarLeds')

    # Switch on shoulder leds
    leds.createGroup("shoulder_group", SHOULDER_LEDS)
    leds.on("shoulder_group")

    #----------------------------------------------------------#
    #--------------------- Test selection ---------------------#
    #----------------------------------------------------------#

    # Cables crossing detection
    parameters_cables = tools.read_section("config.cfg",
                                           "CablesRoutingParameters")

    # Bumpers activation detection
    parameters_bumpers = tools.read_section("config.cfg",
                                            "BumpersActivationsParameters")

    # Get the desired type of test
    flag_test = tools.read_section("config.cfg", "TestChoice")

    # Launch bumper counter (thread)
    if int(flag_test["test_bumpers"][0]) == 1:
        bumper_detection = mobile_base_utils.BumpersCounting(
            dcm, mem, leds, wait_time_bumpers)
        bumper_detection.start()

    # Launch cable counter (thread)
    if int(flag_test["test_cables_crossing"][0]) == 1:
        cable_detection = mobile_base_utils.CablesCrossing(dcm, mem)
        cable_detection.start()

    #---------------------------------------------------------#
    #--------------------- Initialization --------------------#
    #---------------------------------------------------------#
    flag_bumpers = False
    flag_cables = False
    list_wheels_to_use = [1, 1, 0]
    #tools.wait(dcm, 30000)
    used_wheels = move_robot(dcm, mem, wait_time, list_wheels_to_use)
    tools.wait(dcm, 2000)

    acc_z = subdevice.InertialSensorBase(dcm, mem, "AccelerometerZ")

    #---------------------------------------------------------#
    #----------------------- Main Loop -----------------------#
    #---------------------------------------------------------#
    while flag_bumpers == False and flag_cables == False:

        try:
            #-------------------- Wall event -------------------#
            if (math.fabs(list_wheel_speed_sensor[0].value) < 0.10) and \
               (math.fabs(list_wheel_speed_sensor[1].value) < 0.10) and \
               (math.fabs(list_wheel_speed_sensor[2].value) < 0.10):

                # Robot hit wall --> Stop it
                list_wheel_speed_actuator[0].qvalue = (0.0, 0)
                list_wheel_speed_actuator[1].qvalue = (0.0, 0)
                list_wheel_speed_actuator[2].qvalue = (0.0, 0)

                # stop_robot(list_wheel_speed_actuator)

                # check temperatures
                check_wheel_temperatures(dcm, leds, list_wheel_temperature,
                                         list_wheel_speed_actuator,
                                         list_wheel_stiffness_actuator)

                alea = int(random.uniform(0, 10))

                if used_wheels[0] == 'fr' and used_wheels[1] == 'fl':

                    wheel_stiffed_1 = list_wheel_stiffness_actuator[0]
                    wheel_stiffed_2 = list_wheel_stiffness_actuator[1]

                    list_wheel_stiffness_actuator[2].qvalue = (1.0, 0)

                    if alea <= 5:
                        wheel_stiffed_1.qvalue = (0.0, 0)
                        list_wheels_to_use = [0, 1, 1]
                    else:
                        wheel_stiffed_2.qvalue = (0.0, 0)
                        list_wheels_to_use = [1, 0, 1]

                if used_wheels[0] == 'fl' and used_wheels[1] == 'b':

                    wheel_stiffed_1 = list_wheel_stiffness_actuator[1]
                    wheel_stiffed_2 = list_wheel_stiffness_actuator[2]

                    list_wheel_stiffness_actuator[0].qvalue = (1.0, 0)

                    if alea <= 5:
                        wheel_stiffed_1.qvalue = (0.0, 0)
                        list_wheels_to_use = [1, 0, 1]
                    else:
                        wheel_stiffed_2.qvalue = (0.0, 0)
                        list_wheels_to_use = [1, 1, 0]

                if used_wheels[0] == 'b' and used_wheels[1] == 'fr':

                    wheel_stiffed_1 = list_wheel_stiffness_actuator[2]
                    wheel_stiffed_2 = list_wheel_stiffness_actuator[0]

                    list_wheel_stiffness_actuator[1].qvalue = (1.0, 0)

                    if alea <= 5:
                        wheel_stiffed_1.qvalue = (0.0, 0)
                        list_wheels_to_use = [1, 1, 0]
                    else:
                        wheel_stiffed_2.qvalue = (0.0, 0)
                        list_wheels_to_use = [0, 1, 1]

                used_wheels = move_robot(dcm, mem, wait_time,
                                         list_wheels_to_use)

                tools.wait(dcm, 2000)

            #-------------------- Check test variables -------------------#
            if int(flag_test["test_bumpers"][0]) == 1 and \
                    bumper_detection.bumpers_activations == \
                    int(parameters_bumpers["nb_bumper_activations"][0]):
                bumper_detection.stop()
                flag_bumpers = True

            if int(flag_test["test_cables_crossing"][0]) == 1 and \
                    cable_detection.cables_crossing == \
                    int(parameters_cables["Nb_cables_crossing"][0]):
                cable_detection.stop()
                flag_cables = True
            #-------- Robot has fallen ----------#
            if (math.fabs(acc_z.value)) < 2.0:

                if int(flag_test["test_bumpers"][0]) == 1:
                    bumper_detection.stop()

                if int(flag_test["test_cables_crossing"][0]) == 1:
                    cable_detection.stop()

                break

        # Exit test if user interrupt
        except KeyboardInterrupt:
            print "\n******* User interrupt - ending test *******"
            if int(flag_test["test_bumpers"][0]) == 1:
                bumper_detection.stop()
            if int(flag_test["test_cables_crossing"][0]) == 1:
                cable_detection.stop()
            break