robot
Package¶
robot
Module¶
-
class
pypot.robot.robot.
Robot
(motor_controllers=[], sensor_controllers=[], sync=True)[source]¶ Bases:
object
This class is used to regroup all motors and sensors of your robots.
Most of the time, you do not want to directly instantiate this class, but you rather want to use a factory which creates a robot instance - e.g. from a python dictionnary (see Writing the configuration).
This class encapsulates the different controllers (such as dynamixel ones) that automatically synchronize the virtual sensors/effectors instances held by the robot class with the real devices. By doing so, each sensor/effector can be synchronized at a different frequency.
This class also provides a generic motors accessor in order to (more or less) easily extends this class to other types of motor.
Parameters: -
motors
¶ Returns all the motors attached to the robot.
-
sensors
¶ Returns all the sensors attached to the robot.
-
active_primitives
¶ Returns all the primitives currently running on the robot.
-
primitives
¶ Returns all the primitives name attached to the robot.
-
compliant
¶ Returns a list of all the compliant motors.
-
goto_position
(position_for_motors, duration, control=None, wait=False)[source]¶ Moves a subset of the motors to a position within a specific duration.
Parameters:
-
motor
Module¶
sensor
Module¶
controller
Module¶
-
class
pypot.robot.controller.
AbstractController
(io, sync_freq)[source]¶ Bases:
pypot.utils.stoppablethread.StoppableLoopThread
Abstract class for motor/sensor controller.
The controller role is to synchronize the reading/writing of a set of instances with their “hardware” equivalent through an
AbstractIO
object. It is defined as aStoppableLoopThread
where each loop update synchronizes values from the “software” objects with their “hardware” equivalent.To define your Controller, you need to define the
update()
method. This method will be called at the predefined frequency. An exemple of how to do it can be found inBaseDxlController
.Parameters: - io (
AbstractIO
) – IO used to communicate with the hardware motors - sync_freq (float) – synchronization frequency
- io (
-
class
pypot.robot.controller.
MotorsController
(io, motors, sync_freq=50)[source]¶ Bases:
pypot.robot.controller.AbstractController
Abstract class for motors controller.
The controller synchronizes the reading/writing of a set of motor instances with their “hardware”. Each update loop synchronizes values from the “software”
DxlMotor
with their “hardware” equivalent.Parameters: - io (
AbstractIO
) – IO used to communicate with the hardware motors - motors (list) – list of motors attached to the controller
- sync_freq (float) – synchronization frequency
- io (
-
class
pypot.robot.controller.
SensorsController
(io, sensors, sync_freq=50.0)[source]¶ Bases:
pypot.robot.controller.AbstractController
Abstract class for sensors controller.
The controller frequently pulls new data from a “real” sensor and updates its corresponding software instance.
Parameters: - io (
AbstractIO
) – IO used to communicate with the hardware motors - sensors (list) – list of sensors attached to the controller
- sync_freq (float) – synchronization frequency
- io (
config
Module¶
The config module allows the definition of the structure of your robot.
Configuration are written as Python dictionary so you can define/modify them programmatically. You can also import them form file such as JSON formatted file. In the configuration you have to define:
- controllers: For each defined controller, you can specify the port name, the attached motors and the synchronization mode.
- motors: You specify all motors belonging to your robot. You have to define their id, type, orientation, offset and angle_limit.
- motorgroups: It allows to define alias of group of motors. They can be nested.
-
pypot.robot.config.
from_config
(config, strict=True, sync=True, use_dummy_io=False, **extra)[source]¶ Returns a
Robot
instance created from a configuration dictionnary.Parameters: For details on how to write such a configuration dictionnary, you should refer to the section Writing the configuration.
-
pypot.robot.config.
check_motor_eprom_configuration
(config, dxl_io, motor_names)[source]¶ Change the angles limits depanding on the robot configuration ; Check if the return delay time is set to 0.
-
pypot.robot.config.
from_json
(json_file, sync=True, strict=True, use_dummy_io=False, **extra)[source]¶ Returns a
Robot
instance created from a JSON configuration file.For details on how to write such a configuration file, you should refer to the section Writing the configuration.
remote
Module¶
-
class
pypot.robot.remote.
RemoteRobotClient
(host, port)[source]¶ Bases:
object
Remote Access to a Robot through the REST API.
This RemoteRobot gives you access to motors and alias. For each motor you can read/write all of their registers.
You also have access to primitives. More specifically you can start/stop them.