WHILL Model CR SDK for Python
- WHILL Model CR (Normal Model C does not support serial communication.)
- Python3.6 or later (Python2 SDK is currently under develpment)
- pySerial (https://github.com/pyserial/pyserial)
- Windows 10
- MacOS X (Currently under migration. Any pull request is more than welcome)
- Ubuntu 16.04 (Currently under migration. Any pull request is more than welcome)
Clone or download this repository at any place you want.
<your_obj_name> = ComWHILL(port=<Your COM Port>)
Initialize WHILL instance with SoftwareSerial.
<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.
<your_obj_name>.set_joy_stick(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_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.
<your_obj_name>.accelerometer
Accelerometer mounted on body.
<your_obj_name>.gyro
Gyro sensor mounted on body.
<your_obj_name>.battery
Remaining battery level[%] and consumpting current[mA].
<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.
<your_obj_name>.speed_mode_indicator
Current selected speed mode.
<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
MIT License