Beagle
Instance declaration
When you add a Beagle block to the workspace, the following instance declaration is automatically inserted into the Python code:
beagle = Beagle(0)
# When there are multiple instances
beagle_1 = Beagle(1)Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| index | Dropdown option | Instance number (starting from 0) | Integer 0 or greater | 0 |
Set wheel speed
Determines the wheel speed. The speed ranges from -100 to 100.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| unit | Dropdown option | Wheel to control | left, right, both | - |
| speed | Input (block) | Wheel speed | Integer -100 to 100, 0: stop | - |
Python
beagle = Beagle(0)
beagle.set_wheel_speed('both', 50)Move a distance
Moves the specified distance at the current wheel speed.
If the wheel speed has not been set, it moves forward at the default speed.
If the distance is 0, it keeps moving according to the current wheel speed.
If wait is checked, execution waits until the movement is complete.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| data | Input (block) | Distance to move | Real number 0 or greater | - |
| unit | Dropdown option | Distance unit | cm, mm, inch | cm |
| wait | Checkbox | Whether to wait for completion | TRUE / FALSE | TRUE |
Python
beagle = Beagle(0)
beagle.move_distance(50, 'cm', wait=True)Move for a time
Moves for the specified time at the current wheel speed.
If the wheel speed has not been set, it moves forward at the default speed.
If wait is checked, execution waits until the movement is complete.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| data | Input (block) | Time to move (seconds) | Real number 0 or greater | - |
| wait | Checkbox | Whether to wait for completion | TRUE / FALSE | TRUE |
Python
beagle = Beagle(0)
# wait = TRUE
beagle.move_time(5, wait=True)
# wait = FALSE
beagle.move_time(0.5, wait=False)Turn in place
Sets the direction and angle to rotate in place.
If wait is checked, execution waits until the rotation is complete.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| direction | Dropdown option | Direction of rotation | left, right | - |
| data | Input (block) | Angle of rotation (degrees) | Real number 0 or greater | - |
| wait | Checkbox | Whether to wait for completion | TRUE / FALSE | TRUE |
Python
beagle = Beagle(0)
beagle.turn_degree('left', 90, wait=True)Change wheel speed
Changes the wheel speed of Beagle.
The new wheel speed is the current wheel speed plus the speed you enter.
The newly set wheel speed is clamped to the range -100 to 100.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| unit | Dropdown option | Wheel to control | left, right, both | - |
| speed | Input (block) | Amount of speed change | Integer -200 to 200 | - |
Python
beagle = Beagle(0)
beagle.change_wheel_speed('both', 10)Stop
Stops the movement of Beagle.
The speed of both wheels of Beagle is reset to 0.

Parameters
(none)
Python
beagle = Beagle(0)
beagle.stop()Is the wheel moving?
Returns true if the wheel is moving, and false if it is stopped.

Parameters
(none)
Python
beagle = Beagle(0)
beagle.wheel_moving()Set sound buzz
Sets the buzzer sound of Beagle to the specified frequency.
The frequency range that can produce sound is 27.5 Hz to 6553.5 Hz.
If you enter a value outside this range, no buzzer sound is produced.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| hz | Input (block) | Frequency (Hz) | Real number 0, or 27.5 to 6553.5 (0 otherwise) | - |
Python
beagle = Beagle(0)
beagle.sound_buzz(440)Play a note
Beagle plays the specified note.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| note | Dropdown option | Note | Do (C), Do# (C#), Re (D), Re# (D#), Mi (E), Fa (F), Fa# (F#), Sol (G), Sol# (G#), La (A), La# (A#), Si (B) | - |
| octave | Dropdown option | Octave | 1, 2, 3, 4, 5, 6, 7 | 4 |
Python
beagle = Beagle(0)
beagle.sound_note('D', 5)Play a sound clip
Beagle plays a particular sound clip.
If wait is checked, execution waits until playback is complete.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| clip | Dropdown option | Sound clip name | 'mute', 'beep', 'siren', 'engine', 'robot', 'dibidibidip', 'happy', 'angry', 'sad', 'sleep', 'march', 'birthday', and so on | - |
| wait | Checkbox | Whether to wait for completion | TRUE / FALSE | TRUE |
Python
beagle = Beagle(0)
beagle.sound_clip('siren', wait=True)Sound off
Turns off the sound of Beagle.

Parameters
(none)
Python
beagle = Beagle(0)
beagle.sound_off()Is a sound playing?
Returns true if a sound is playing, and false if it is not.

Parameters
(none)
Python
beagle = Beagle(0)
beagle.sound_playing()Wheel speed value
The speed of a particular wheel

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| unit | Dropdown option | Wheel to read | left, right | - |
Python
beagle = Beagle(0)
beagle.wheel_speed('left')Encoder value
The encoder value of a particular wheel

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| unit | Dropdown option | Wheel to read | left, right | - |
Python
beagle = Beagle(0)
beagle.encoder('left')Gyroscope sensor value
The value of the gyroscope sensor along a particular axis

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| unit | Dropdown option | Axis to measure | x, y, z | - |
Python
beagle = Beagle(0)
beagle.gyroscope('x')Accelerometer sensor value
The value of the accelerometer sensor along a particular axis

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| unit | Dropdown option | Axis to measure | x, y, z | - |
Python
beagle = Beagle(0)
beagle.accelerometer('x')Magnetometer sensor value
The value of the magnetometer sensor along a particular axis

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| unit | Dropdown option | Axis to measure | x, y, z | - |
Python
beagle = Beagle(0)
beagle.magnetometer('x')Temperature sensor value
The temperature sensor value

Parameters
(none)
Python
beagle = Beagle(0)
beagle.temperature()Signal strength value
The signal strength

Parameters
(none)
Python
beagle = Beagle(0)
beagle.signal_strength()Battery voltage
The battery voltage

Parameters
(none)
Python
beagle = Beagle(0)
beagle.battery()Whether the state has changed
Whether the state of the robot has changed

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| unit | Dropdown option | Kind of state | 0 to 5 (see the table below) | - |
| unit | Condition |
|---|---|
| 0 | accelerometer('x') > 0.8 |
| 1 | accelerometer('x') < -0.8 |
| 2 | accelerometer('y') > 0.8 |
| 3 | accelerometer('y') < -0.8 |
| 4 | accelerometer('z') > 0 |
| 5 | accelerometer('z') < 0 |
Python
beagle = Beagle(0)
# unit = 0
beagle.accelerometer('x') > 0.8Turn the lidar on / off
Enables or disables the lidar sensor.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| on | Dropdown option | Lidar ON / OFF | start (True), stop (False) | TRUE |
Python
beagle = Beagle(0)
beagle.lidar_power(True)Distance value of the Nth object from the lidar
The lidar sensor can measure the distance to objects all around, over 360 degrees.
Starting from the front of Beagle (value number 0), the number increases by 1 as you go counterclockwise.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| unit | Input (field) | Object number (starting from 0) | Integer 0 or greater | - |
Python
beagle = Beagle(0)
beagle.lidar_value(0)Lidar distance value by direction
Gives the distance measured by the lidar sensor to the front, back, both sides, and the diagonal directions.
It outputs the average of the distance values within 45 degrees to the left and right of that direction.

Parameters
| Name | Kind | Description | Range / Type | Default |
|---|---|---|---|---|
| direction | Dropdown option | Direction to measure | front, left front, left, left back, back, right back, right, right front | - |
Python
beagle = Beagle(0)
beagle.lidar_directions('front')Is the lidar ready?
Returns whether the lidar is on as true (True) / false (False).

Parameters
(none)
Python
beagle = Beagle(0)
beagle.lidar_ready()