examples.distribute_aligned_myts.
DistributedThymio2
(name, **kwargs)¶Superclass: pyenki.Thymio2
-> the world update step will automatically call the Thymio controlStep
.
name – name of the agent
kwargs – other arguments
compute_difference
()¶the difference between the response value of front and the rear sensor
controlStep
(dt: float) → None¶Perform one control step: Move the robots in such a way they stand at equal distances from each other without using communication.
Move the robots not to the end of the line using the distributed controller, setting the target {left, right} wheel speed each at the same value in order to moves the robot straight ahead. This distributed controller is a simple proportional controller PID(-0.01, 0, 0, max_out=16.6, min_out=-16.6) that takes in input the difference between the response value of front and the rear sensor. To the distance measured by the rear sensors is applied a small correction since the front sensor used is at a different x coordinate from the point to which the rear sensor of the robot that follows points. This is because of the curved shape of the face of the Thymio. The response values are actually intensities: the front correspond to the frontal center sensor and the back to the mean of the response values of the rear sensors. The final difference is computed ad follow: out = front - correction - back The speed are clipped to [min_out=-16.6, max_out=16.6].
dt – control step duration
neighbors_distance
()¶Check if there is a robot ahead using the infrared sensor 2 (front-front). Check if there is a robot ahead using the infrared sensor 5 (back-left) and 6 (back-right).
response values of the rear and front sensors
examples.distribute_aligned_myts.
run
(world: pyenki.pyenki.World, gui: bool = False, T: float = 10, dt: float = 0.1) → None¶world – enki world
gui – variable that states if use the gui
T – duration of the simulation in seconds
dt – control step duration – update timestep in seconds, should be below 1 (typically .02-.1)
examples.distribute_aligned_myts.
setup
(aseba: bool = False) → pyenki.pyenki.World¶Set up the world as an unbounded world. Create multiple agents and position them such as all x-axes are aligned. The robots are already arranged in an ‘indian row’ (all x-axes aligned) and within the proximity sensor range.
aseba – states if use aseba (default: False)
enki world
examples.colour_aligned_myts.
DistributedThymio2
(myt_quantity, name, **kwargs)¶Superclass: pyenki.Thymio2
-> the world update step will automatically call the Thymio controlStep
.
myt_quantity – number of agents
name – name of the agent
kwargs – other arguments
compute_difference
()¶the difference between the response value of front and the rear sensor
controlStep
(dt: float) → None¶Perform one control step: Move the robots not to the end of the line using the distributed controller, setting the target {left, right} wheel speed each at the same value in order to moves the robot straight ahead. This distributed controller is a simple proportional controller PID(-0.01, 0, 0, max_out=16.6, min_out=-16.6) that takes in input the difference between the response value of front and the rear sensor. To the distance measured by the rear sensors is applied a small correction since the front sensor used is at a different x coordinate from the point to which the rear sensor of the robot that follows points. This is because of the curved shape of the face of the Thymio. The response values are actually intensities: the front correspond to the frontal center sensor and the back to the mean of the response values of the rear sensors. The final difference is computed ad follow: out = front - correction - back The speed are clipped to [min_out=-16.6, max_out=16.6]. Then, using communication, colour the robot half and half. They should understand on which side they are compared to the mid of the line
dt – control step duration
neighbors_distance
()¶Check if there is a robot ahead using the infrared sensor 2 (front-front). Check if there is a robot ahead using the infrared sensor 5 (back-left) and 6 (back-right).
response values of the rear and front sensors
examples.colour_aligned_myts.
run
(world: pyenki.pyenki.World, gui: bool = False, T: float = 10, dt: float = 0.1) → None¶world – enki world
gui – variable that states if use the gui
T – duration of the simulation in seconds
dt – control step duration – update timestep in seconds, should be below 1 (typically .02-.1)
examples.colour_aligned_myts.
setup
(aseba: bool = False) → pyenki.pyenki.World¶Set up the world as an unbounded world. Create multiple Thymios and position them such as all x-axes are aligned. The robots are already arranged in an “indian row” (all x-axes aligned) and within the proximity sensor range.
aseba – states if use aseba (default: False)
enki world