Thymio#
- class pyaseba.client.thymio.Thymio(cached: bool = False, record_prox_comm: bool = False, enable_prox_comm: bool = False)#
High-level interface to a remote Thymio.
>>> thymio = Thymio() >>> thymio.connect() >>> thymio.leds_top = [32, 0, 32] >>> thymio.prox_horizontal [0, 0, 1215, 1563, 2065, 0, 0]
that can run an offboard Python controller like
>>> def control(thymio: Thymio) -> None if thymio.prox_horizontal[2] > 2000: thymio.motor_left_target = 0 thymio.motor_right_target = 0 else: thymio.motor_left_target = 100 thymio.motor_right_target = 100 >>> >>> thymio.set_controller(control)
- property acc: int | list[int]#
Aseba variable acc
- property acc__tap: int | list[int]#
Aseba variable acc._tap
- apply(callback: Callback[__annotationlib_name_1__], *args: ~typing.~P, **kwargs: ~typing.~P) None#
Calls a callback and then calls
sync().- Parameters:
callback – The callback
args – The callback arguments
kwargs – The callback keywords arguments
- property button_backward: int | list[int]#
Aseba variable button.backward
- property button_center: int | list[int]#
Aseba variable button.center
- property button_forward: int | list[int]#
Aseba variable button.forward
- property button_left: int | list[int]#
Aseba variable button.left
- property button_right: int | list[int]#
Aseba variable button.right
- property buttons__mean: int | list[int]#
Aseba variable buttons._mean
- property buttons__noise: int | list[int]#
Aseba variable buttons._noise
- property buttons__raw: int | list[int]#
Aseba variable buttons._raw
- call__leds_set(*args: int) None#
Calls native function _leds.set
- Parameters:
args – The argument passed to the function.
- call_leds_bottom_left(*args: int) None#
Calls native function leds.bottom.left
- Parameters:
args – The argument passed to the function.
- call_leds_bottom_right(*args: int) None#
Calls native function leds.bottom.right
- Parameters:
args – The argument passed to the function.
- call_leds_buttons(*args: int) None#
Calls native function leds.buttons
- Parameters:
args – The argument passed to the function.
- call_leds_circle(*args: int) None#
Calls native function leds.circle
- Parameters:
args – The argument passed to the function.
- call_leds_prox_h(*args: int) None#
Calls native function leds.prox.h
- Parameters:
args – The argument passed to the function.
- call_leds_prox_v(*args: int) None#
Calls native function leds.prox.v
- Parameters:
args – The argument passed to the function.
- call_leds_rc(*args: int) None#
Calls native function leds.rc
- Parameters:
args – The argument passed to the function.
- call_leds_sound(*args: int) None#
Calls native function leds.sound
- Parameters:
args – The argument passed to the function.
- call_leds_temperature(*args: int) None#
Calls native function leds.temperature
- Parameters:
args – The argument passed to the function.
- call_leds_top(*args: int) None#
Calls native function leds.top
- Parameters:
args – The argument passed to the function.
- call_prox_comm_enable(*args: int) None#
Calls native function prox.comm.enable
- Parameters:
args – The argument passed to the function.
- call_sound_duration(*args: int) None#
Calls native function sound.duration
- Parameters:
args – The argument passed to the function.
- call_sound_freq(*args: int) None#
Calls native function sound.freq
- Parameters:
args – The argument passed to the function.
- call_sound_play(*args: int) None#
Calls native function sound.play
- Parameters:
args – The argument passed to the function.
- call_sound_record(*args: int) None#
Calls native function sound.record
- Parameters:
args – The argument passed to the function.
- call_sound_replay(*args: int) None#
Calls native function sound.replay
- Parameters:
args – The argument passed to the function.
- call_sound_system(*args: int) None#
Calls native function sound.system
- Parameters:
args – The argument passed to the function.
- control_event = 'timer0'#
Which local event to use to trigger the control step
- default_target = 'ser:name=Thymio'#
Default Dashel target
- property event_args: int | list[int]#
Aseba variable event.args
- property event_source: int | list[int]#
Aseba variable event.source
- property leds_bottom_left: int | list[int]#
Aseba variable leds.bottom.left
- property leds_bottom_right: int | list[int]#
Aseba variable leds.bottom.right
- property leds_circle: int | list[int]#
Aseba variable leds.circle
- property leds_top: int | list[int]#
Aseba variable leds.top
- property mic__mean: int | list[int]#
Aseba variable mic._mean
- property mic_intensity: int | list[int]#
Aseba variable mic.intensity
- property mic_threshold: int | list[int]#
Aseba variable mic.threshold
- property motor_left_pwm: int | list[int]#
Aseba variable motor.left.pwm
- property motor_left_speed: int | list[int]#
Aseba variable motor.left.speed
- property motor_left_target: int | list[int]#
Aseba variable motor.left.target
- property motor_right_pwm: int | list[int]#
Aseba variable motor.right.pwm
- property motor_right_speed: int | list[int]#
Aseba variable motor.right.speed
- property motor_right_target: int | list[int]#
Aseba variable motor.right.target
- property on_button_backward: Callable[[Node], None] | None#
Callback for Aseba event button.backward
- property prox_comm_rx: int | list[int]#
Aseba variable prox.comm.rx
- property prox_comm_rx__align_tol: int | list[int]#
Aseba variable prox.comm.rx._align_tol
- property prox_comm_rx__intensities: int | list[int]#
Aseba variable prox.comm.rx._intensities
- property prox_comm_rx__lead: int | list[int]#
Aseba variable prox.comm.rx._lead
- property prox_comm_rx__payloads: int | list[int]#
Aseba variable prox.comm.rx._payloads
- property prox_comm_rx__tol: int | list[int]#
Aseba variable prox.comm.rx._tol
- property prox_comm_rx__trail: int | list[int]#
Aseba variable prox.comm.rx._trail
- property prox_comm_tx: int | list[int]#
Aseba variable prox.comm.tx
- property prox_ground_ambiant: int | list[int]#
Aseba variable prox.ground.ambiant
- property prox_ground_delta: int | list[int]#
Aseba variable prox.ground.delta
- property prox_ground_reflected: int | list[int]#
Aseba variable prox.ground.reflected
- property prox_horizontal: int | list[int]#
Aseba variable prox.horizontal
- property rc5_address: int | list[int]#
Aseba variable rc5.address
- property rc5_command: int | list[int]#
Aseba variable rc5.command
- property sd_present: int | list[int]#
Aseba variable sd.present
- set_behavior(behavior: Behavior, time_step: float = 0.1, event: str = '') None#
Setup a behavior. Same as
set_controller().- Parameters:
behavior – The callback called at each control step
time_step – The control time step
event – The event that should trigger a control step
- set_control_period(time_step: float, event: str = '') None#
A virtual method to setup the controller The base implementation is empty. Override to specialize the class.
- Parameters:
time_step – The time step
event – The name of the local event that should trigger a control step.
- stop() None#
Sends a command to stop running the remote node.
- property temperature: int | list[int]#
Aseba variable temperature
- property timer_period: int | list[int]#
Aseba variable timer.period
- class pyaseba.client.thymio.ThymioAsync(cached: bool = False, record_prox_comm: bool = False, enable_prox_comm: bool = False)#
Asynchronous version of
pyaseba.client.thymio.Thymiobased onpyaseba.client.NodeAsync.