Skip to content

Latest commit

 

History

History
125 lines (82 loc) · 3.09 KB

README.md

File metadata and controls

125 lines (82 loc) · 3.09 KB

whill-sdk-arduino

About

The "whill-sdk-arduino" is a simple Arduino library for Model CR series.

We also have Model CR Series Technical Support for current and potential Model CR series users.

Requirements

  • Host device
    • An Arduino device suports SoftwareSerial. e.g. Arduino Uno.
  • Target device
    • Model CR series (Normal Model C or Model C2 does not support serial communication.)
  • Connector

Getting Started

Download this repository and place on your Arduino library folder.

APIs

Initialize

WHILL(SoftwareSerial*)

Initialize WHILL instance with SoftwareSerial.

Power Control

WHILL::setPower(bool)

Turn on/off a WHILL. True to power WHILL on.

WHILL::setBatteryVoltaegeOut(bool)

Enable/Disable power supply to the interface connector. True to enable power supply.
Note: This command is for Model CR only.

Motor Control

WHILL::setJoystick(int x, int y)

Manipulate a WHILL via this command. Both x and y are integer values with range -100 ~ 100.

WHILL::setVelocity(int y, int x)

Control the speed of a WHILL directly via this command. y is integer values with range -500 ~ 1500 [0.004km/h]. x 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

WHILL::begin(unsigned int interval_ms)

Command WHILL to start reporting WHILL status (Dataset1).

WHILL::refresh()

Fetch serial interface and do internal process. Call this function, WHILL::delay() and/or WHILL::keep_joy_delay() once at least in loop(). Callbacks are fired when these functions are called.

WHILL::stopSendingData()

Command WHILL to stop report WHILL status.

Data Reference

Battery

unsigned char  WHILL::battery.level
signed long    WHILL::battery.current

Remaining battery level and consumpting current[mA].

Motor State

float   WHILL::left_motor.angle
int     WHILL::left_motor.speed
float   WHILL::right_motor.angle
int     WHILL::right_motor.speed

Angle and speed of motors. The angle range is -PI to +PI, the speed unit is [km/h].
Note: The speed value is low-pass filtered.

Speed Mode

bool   WHILL::speed_mode_indicator

Current selected speed mode.

Callback

By registering callback functions, you can hook at status is updated.
See Example: callback.ino

License

MIT License