Skip to content

Commit

Permalink
Merge pull request #8 from WHILL/feature/update_doc_for_cr2
Browse files Browse the repository at this point in the history
Update readme for CR2
  • Loading branch information
GeorgeMandokoro authored Nov 30, 2023
2 parents 869aca9 + a9307ef commit 0b20f2c
Showing 1 changed file with 38 additions and 34 deletions.
72 changes: 38 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
# pywhill
pywhill is a WHILL Model CR SDK for Python. <br>
We also have [Model CR Technical Support repository](https://github.com/WHILL/Model_CR_Technical_Support) for current and potential Model CR users. <br>
For general questions and requests, please visit our [product page](https://whill.inc/jp/model-cr) .
"pywhill" is a Python SDK for WHILL Model CR series. <br>
We also have [Model CR Series Technical Support](https://github.com/WHILL/Model_CR_Technical_Support) for current and potential Model CR series users. <br>
For general questions and requests, please visit our [product page](https://whill.inc/jp/model-cr2) .

<img src="https://user-images.githubusercontent.com/2618822/45492944-89421c00-b7a8-11e8-9c92-22aa3f28f6e4.png" width=30%>

**Note:** "Model CR series" refers to Model CR and Model CR2.

## Requirements
- WHILL **Model CR** (Normal **Model C** does not support serial communication.)
- 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
- Windows 10 / 11
- MacOS X
- Ubuntu 16.04
- Ubuntu 18.04

## Getting Started
## Installation
Clone or download this repository at any place you want, or this package is avalable on [PyPI](https://pypi.org/project/whill/).

```
Expand All @@ -34,59 +35,62 @@ from whill import ComWHILL
```
Initialize WHILL instance with SoftwareSerial.

### Communication

### Power Control
```python
<your_obj_name>.start_data_stream(interval_msec=<update interval in millisecond>)
<your_obj_name>.send_power_on()
<your_obj_name>.send_power_off()
<your_obj_name>.set_power(power_state_command=<True/False>)
```
Command WHILL to start reporting WHILL status.
Turn on/off a WHILL. `power_state_command` is a bool with `True` to power WHILL on.

```python
<your_obj_name>.refresh()
<your_obj_name>.set_battery_voltage_output_mode(vbatt_on_off=<True/False>)
```
Fetch serial interface and do internal process.

Enable/Disable power supply to the interface connector. `True` to enable power supply. **For Model CR only.**

### Motor Control
```python
<your_obj_name>.stop_data_stream()
<your_obj_name>.send_joystick(front=<Integer -100~100>, side=<Integer -100~100>)
```
Command WHILL to stop report WHILL status.

Manipulate a WHILL via this command.
Both `front` and `side` are integer values with range -100 ~ 100.

### Manipulation

```python
<your_obj_name>.send_joystick(front=<Integer -100~100>, side=<Integer -100~100>)
<your_obj_name>.send_velocity(front=<Integer -500~1500>, side=<Integer -750~750>)
```
Manipulate a WHILL via this command.
Both `front` and `side` are integer values with range -100 ~ 100.
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

```python
<your_obj_name>.send_power_on()
<your_obj_name>.send_power_off()
<your_obj_name>.set_power(power_state_command=<True/False>)
<your_obj_name>.start_data_stream(interval_msec=<update interval in millisecond>)
```
Turn on/off a WHILL. `power_state_command` is a bool with `True` to power WHILL on.
Command WHILL to start reporting WHILL status.

```python
<your_obj_name>.set_battery_voltage_output_mode(vbatt_on_off=<True/False>)
<your_obj_name>.refresh()
```
Enable/Disable power supply to the interface connector. `True` to enable power supply.
Fetch serial interface and do internal process.


```python
<your_obj_name>.send_velocity(front=<Integer -500~1500>, side=<Integer -750~750>)
<your_obj_name>.stop_data_stream()
```
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.
Command WHILL to stop report WHILL status.


### Sensors and Status
### Data Reference
You can refer to the value fetched by the above command (Data Fetching).

### Accelerometer **(deprecated)**
#### Accelerometer **(deprecated)**
Accelerometer API has been disabled since v1.2.0.

#### Gyro **(deprecated)**
Expand Down Expand Up @@ -117,7 +121,7 @@ Current selected speed mode.
```python
<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.
By registering callback functions, you can hook at status is updated.
See Example: [cr_example3_callback.py](https://github.com/WHILL/pywhill/blob/master/example/cr_example3_callback.py)

## License
Expand Down

0 comments on commit 0b20f2c

Please sign in to comment.