# Path: pypot/dynamixel/conversion.py
# def dxl_to_degree(value, model):
# def degree_to_dxl(value, model):
# def _speed_factor(model):
# def dxl_to_speed(value, model):
# def speed_to_dxl(value, model):
# def dxl_to_torque(value, model):
# def torque_to_dxl(value, model):
# def dxl_to_load(value, model):
# def dxl_to_acceleration(value, model):
# def acceleration_to_dxl(value, model):
# def dxl_to_pid(value, model):
# def pid_to_dxl(value, model):
#     def truncate(x):
# def dxl_to_model(value, dummy=None):
# def check_bit(value, offset):
# def dxl_to_drive_mode(value, model):
# def drive_mode_to_dxl(value, model):
# def dxl_to_baudrate(value, model):
# def baudrate_to_dxl(value, model):
# def dxl_to_rdt(value, model):
# def rdt_to_dxl(value, model):
# def dxl_to_temperature(value, model):
# def temperature_to_dxl(value, model):
# def dxl_to_current(value, model):
# def dxl_to_voltage(value, model):
# def voltage_to_dxl(value, model):
# def dxl_to_status(value, model):
# def status_to_dxl(value, model):
# def dxl_to_alarm(value, model):
# def decode_error(error_code):
# def alarm_to_dxl(value, model):
# def dxl_to_led_color(value, model):
# def led_color_to_dxl(value, model):
# def dxl_to_control_mode(value, _):
# def control_mode_to_dxl(mode, _):
# def dxl_to_bool(value, model):
# def bool_to_dxl(value, model):
# def dxl_decode(data):
# def dxl_decode_all(data, nb_elem):
# def dxl_code(value, length):
# def dxl_code_all(value, length, nb_elem):
# 
# Path: pypot/vrep/io.py
# class VrepIO(AbstractIO):
# class VrepIOError(Exception):
# class VrepIOErrors(Exception):
# class VrepConnectionError(Exception):
#     MAX_ITER = 5
#     TIMEOUT = 0.4
#     def __init__(self, vrep_host='127.0.0.1', vrep_port=19997, scene=None, start=False):
#     def open_io(self):
#     def close(self):
#     def load_scene(self, scene_path, start=False):
#     def start_simulation(self):
#     def restart_simulation(self):
#     def stop_simulation(self):
#     def pause_simulation(self):
#     def resume_simulation(self):
#     def get_motor_position(self, motor_name):
#     def set_motor_position(self, motor_name, position):
#     def get_motor_force(self, motor_name):
#     def set_motor_force(self, motor_name, force):
#     def get_object_position(self, object_name, relative_to_object=None):
#     def set_object_position(self, object_name, position=[0, 0, 0]):
#     def get_object_orientation(self, object_name, relative_to_object=None):
#     def _get_object_handle(self, obj):
#     def get_object_handle(self, obj):
#     def get_collision_state(self, collision_name):
#     def _get_collision_handle(self, collision):
#     def get_collision_handle(self, collision):
#     def get_simulation_current_time(self, timer='CurrentTime'):
#     def add_cube(self, name, position, sizes, mass):
#     def add_sphere(self, name, position, sizes, mass, precision=[10, 10]):
#     def add_cylinder(self, name, position, sizes, mass, precision=[10, 10]):
#     def add_cone(self, name, position, sizes, mass, precision=[10, 10]):
#     def change_object_name(self, old_name, new_name):
#     def _create_pure_shape(self, primitive_type, options, sizes, mass, precision):
#     def _inject_lua_code(self, lua_code):
#     def call_remote_api(self, func_name, *args, **kwargs):
#     def _extract_mode(self, kwargs):
# def close_all_connections():
#     def __init__(self, error_code, message):


from numpy import rad2deg, deg2rad
from collections import deque
from ..robot.controller import MotorsController, SensorsController
from ..dynamixel.conversion import torque_max
from ..robot.sensor import Sensor
from .io import remote_api
        pos = [self.io.get_motor_position(self._motor_name(m)) for m in self.motors]

        # Prepare streaming for setting position for each motor
        for m, p in zip(self.motors, pos):
            self.io.call_remote_api('simxSetJointTargetPosition',
                                    self.io.get_object_handle(self._motor_name(m)),
                                    p,
                                    sending=True,
                                    _force=True)

        for m in self.motors:
            self.io.call_remote_api('simxSetJointForce',
                                    self.io.get_object_handle(self._motor_name(m)),
                                    torque_max[m.model],
                                    sending=True,
                                    _force=True)

        # Prepare streaming for the angle limit
        self.io.call_remote_api('simxGetObjectGroupData',
                                remote_api.sim_object_joint_type,
                                16,
                                streaming=True,
                                _force=True)

        # And actually affect them
        for m, p in zip(self.motors, pos):
            self.io.set_motor_position(self._motor_name(m), p)
            m.__dict__['goal_position'] = rad2deg(p)

        for m in self.motors:

# Path: pypot/dynamixel/conversion.py
# def dxl_to_degree(value, model):
# def degree_to_dxl(value, model):
# def _speed_factor(model):
# def dxl_to_speed(value, model):
# def speed_to_dxl(value, model):
# def dxl_to_torque(value, model):
# def torque_to_dxl(value, model):
# def dxl_to_load(value, model):
# def dxl_to_acceleration(value, model):
# def acceleration_to_dxl(value, model):
# def dxl_to_pid(value, model):
# def pid_to_dxl(value, model):
#     def truncate(x):
# def dxl_to_model(value, dummy=None):
# def check_bit(value, offset):
# def dxl_to_drive_mode(value, model):
# def drive_mode_to_dxl(value, model):
# def dxl_to_baudrate(value, model):
# def baudrate_to_dxl(value, model):
# def dxl_to_rdt(value, model):
# def rdt_to_dxl(value, model):
# def dxl_to_temperature(value, model):
# def temperature_to_dxl(value, model):
# def dxl_to_current(value, model):
# def dxl_to_voltage(value, model):
# def voltage_to_dxl(value, model):
# def dxl_to_status(value, model):
# def status_to_dxl(value, model):
# def dxl_to_alarm(value, model):
# def decode_error(error_code):
# def alarm_to_dxl(value, model):
# def dxl_to_led_color(value, model):
# def led_color_to_dxl(value, model):
# def dxl_to_control_mode(value, _):
# def control_mode_to_dxl(mode, _):
# def dxl_to_bool(value, model):
# def bool_to_dxl(value, model):
# def dxl_decode(data):
# def dxl_decode_all(data, nb_elem):
# def dxl_code(value, length):
# def dxl_code_all(value, length, nb_elem):
# 
# Path: pypot/vrep/io.py
# class VrepIO(AbstractIO):
# class VrepIOError(Exception):
# class VrepIOErrors(Exception):
# class VrepConnectionError(Exception):
#     MAX_ITER = 5
#     TIMEOUT = 0.4
#     def __init__(self, vrep_host='127.0.0.1', vrep_port=19997, scene=None, start=False):
#     def open_io(self):
#     def close(self):
#     def load_scene(self, scene_path, start=False):
#     def start_simulation(self):
#     def restart_simulation(self):
#     def stop_simulation(self):
#     def pause_simulation(self):
#     def resume_simulation(self):
#     def get_motor_position(self, motor_name):
#     def set_motor_position(self, motor_name, position):
#     def get_motor_force(self, motor_name):
#     def set_motor_force(self, motor_name, force):
#     def get_object_position(self, object_name, relative_to_object=None):
#     def set_object_position(self, object_name, position=[0, 0, 0]):
#     def get_object_orientation(self, object_name, relative_to_object=None):
#     def _get_object_handle(self, obj):
#     def get_object_handle(self, obj):
#     def get_collision_state(self, collision_name):
#     def _get_collision_handle(self, collision):
#     def get_collision_handle(self, collision):
#     def get_simulation_current_time(self, timer='CurrentTime'):
#     def add_cube(self, name, position, sizes, mass):
#     def add_sphere(self, name, position, sizes, mass, precision=[10, 10]):
#     def add_cylinder(self, name, position, sizes, mass, precision=[10, 10]):
#     def add_cone(self, name, position, sizes, mass, precision=[10, 10]):
#     def change_object_name(self, old_name, new_name):
#     def _create_pure_shape(self, primitive_type, options, sizes, mass, precision):
#     def _inject_lua_code(self, lua_code):
#     def call_remote_api(self, func_name, *args, **kwargs):
#     def _extract_mode(self, kwargs):
# def close_all_connections():
#     def __init__(self, error_code, message):


# Path: pypot/vrep/controller.py
from numpy import rad2deg, deg2rad
from collections import deque
from ..robot.controller import MotorsController, SensorsController
from ..dynamixel.conversion import torque_max
from ..robot.sensor import Sensor
from .io import remote_api

        pos = [self.io.get_motor_position(self._motor_name(m)) for m in self.motors]

        # Prepare streaming for setting position for each motor
        for m, p in zip(self.motors, pos):
            self.io.call_remote_api('simxSetJointTargetPosition',
                                    self.io.get_object_handle(self._motor_name(m)),
                                    p,
                                    sending=True,
                                    _force=True)

        for m in self.motors:
            self.io.call_remote_api('simxSetJointForce',
                                    self.io.get_object_handle(self._motor_name(m)),
                                    torque_max[m.model],
                                    sending=True,
                                    _force=True)

        # Prepare streaming for the angle limit
        self.io.call_remote_api('simxGetObjectGroupData',
                                remote_api.sim_object_joint_type,
                                16,
                                streaming=True,
                                _force=True)

        # And actually affect them
        for m, p in zip(self.motors, pos):
            self.io.set_motor_position(self._motor_name(m), p)
            m.__dict__['goal_position'] = rad2deg(p)

        for m in self.motors:

            self.io.set_motor_force(self._motor_name(m), torque_max[m.model])