pywhill
"pywhill" is a Python SDK for WHILL Model CR series.
We also have Model CR Series Technical Support for current and potential Model CR series users.
For general questions and requests, please visit our product page .
Note: "Model CR series" refers to Model CR and Model CR2.
Requirements
- WHILL Model CR / CR2 (Normal Model C / C2 does not support serial communication.)
- Python3.6 or later
- pySerial (https://github.com/pyserial/pyserial)
OS Support
- Windows 10 / 11
- MacOS X
- Ubuntu 16.04
- Ubuntu 18.04
Installation
Clone or download this repository at any place you want, or this package is avalable on PyPI.
python3 -m pip install whill
APIs
Initialize
from whill import ComWHILL
<your_obj_name> = ComWHILL(port=<Your COM Port>)
Initialize WHILL instance with SoftwareSerial.
Power Control
<your_obj_name>.send_power_on()
<your_obj_name>.send_power_off()
<your_obj_name>.set_power(power_state_command=<True/False>)
Turn on/off a WHILL. power_state_command is a bool with True to power WHILL on.
<your_obj_name>.set_battery_voltage_output_mode(vbatt_on_off=<True/False>)
Enable/Disable power supply to the interface connector. True to enable power supply. For Model CR only.
<your_obj_name>.set_battery_saving(low_battery_level=<Integer 1~90>, sounds_buzzer=<True/False>)
Configure battery protection settings.
low_battery_level is battery charge level to engage the standby mode with range 1 ~ 90.
sounds_buzzer is Enable/Disable a buzzing sound at the battery charge level of low_battery_level + 10 percentage points. True to enable a buzzing sound when battery level low.
As default, low_battery_level is 19 and sounds_buzzer is True. For Model CR2 only.
Motor Control
<your_obj_name>.send_joystick(front=<Integer -100~100>, side=<Integer -100~100>)
Manipulate a WHILL via this command.
Both front and side are integer values with range -100 ~ 100.
<your_obj_name>.send_velocity(front=<Integer -500~1500>, side=<Integer -750~750>)
Control the speed of a WHILL directly via this command. (Available since v1.3.0)
front is integer values with range -500 ~ 1500 [0.004km/h].
side is integer values with range -750 ~ 750 [0.004km/h].
Attention:
WHILL moves so quickly using SetVelocity command and so pay enough attention to use SetVelocity command. Basically, send this command to increase speed gradually.
Data Fetching
<your_obj_name>.start_data_stream(interval_msec=<update interval in millisecond>)
Command WHILL to start reporting WHILL status.
<your_obj_name>.refresh()
Fetch serial interface and do internal process.
<your_obj_name>.stop_data_stream()
Command WHILL to stop report WHILL status.
Data Reference
You can refer to the value fetched by the above command (Data Fetching).
Accelerometer (deprecated)
Accelerometer API has been disabled since v1.2.0.
Gyro (deprecated)
Gyro API has been disabled since v1.2.0.
Battery
<your_obj_name>.battery
Remaining battery level[%] and consumpting current[mA].
Motor State
<your_obj_name>.left_motor
<your_obj_name>.right_motor
Motors angle and speed. The angle range is -PI to +PI, Speed unit is km/h. Note that the speed value is low-pass filterd.
Speed Mode
<your_obj_name>.speed_mode_indicator
Current selected speed mode.
Callback
<your_obj_name>.register_callback(event=<either 'data_set_0' or 'data_set_1', func=<your callback function>)
By registering callback functions, you can hook at status is updated. See Example: cr_example3_callback.py
License
MIT License
Metadata
Release files for whill 1.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| whill-1.5.0.tar.gz | 11.1 kB | Without provenance | Details for whill-1.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| whill-1.5.0-py3-none-any.whl | Python 3 | none | any | Details for whill-1.5.0-py3-none-any.whl |
Total release size: 21.1 kB
Release files / whill-1.5.0.tar.gz
| Download URL | whill-1.5.0.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
35c6c71d69ebfa64b1019fcd2611ab413f33e0a715f9ddabcf360277060dcdd9
|
|
BLAKE2b-256 checksum How to use checksums |
814e79d0a4744cb229cd5a55f81890c218e3123801da446f541bf01b42b156ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.11
|
Release files / whill-1.5.0-py3-none-any.whl
| Download URL | whill-1.5.0-py3-none-any.whl |
|---|---|
| Size | 10.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8cfca2cbc0b0284bf037bfea0800b112ccbb34debb06740a4a19ab4227e8f89f
|
|
BLAKE2b-256 checksum How to use checksums |
ae0d163ec7e8aa9c5712235ec0226a73529952d0b5d42ad016ad1409a6ad86bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.11
|
Security for whill 1.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.