def topic_from_variable(variable):
    """
    Given a variable, it returns the ROS topic associated to it
    :param variable:
    :return: topic
    """

    # Channels associated with each topic
    wrench_variables = [' force_x', ' force_y', ' force_z', ' torque_x', ' torque_y', ' torque_z']
    f1_imu_variables = [' f1_acc_x', ' f1_acc_y', ' f1_acc_z', ' f1_gyro_x', ' f1_gyro_y', ' f1_gyro_z']
    f2_imu_variables = [' f2_acc_x', ' f2_acc_y', ' f2_acc_z', ' f2_gyro_x', ' f2_gyro_y', ' f2_gyro_z']
    f3_imu_variables = [' f3_acc_x', ' f3_acc_y', ' f3_acc_z', ' f3_gyro_x', ' f3_gyro_y', ' f3_gyro_z']

    topic = ''
    if variable in wrench_variables:
        topic = 'wrench'
    elif variable in f1_imu_variables:
        topic = 'f1_imu'
    elif variable in f2_imu_variables:
        topic = 'f2_imu'
    elif variable in f3_imu_variables:
        topic = 'f3_imu'

    return topic