-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add control point commands, read properties and rizer example (#38)
* fix control point opcodes * add control point commands * add target setting features * add parse_target_setting_features * add rizer service and example * make sure parameters are integer or list * update example for target setting features and simulation parameters * fix linting * add pylint exception
- Loading branch information
Showing
7 changed files
with
473 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import asyncio | ||
from bleak import BleakClient | ||
|
||
from pycycling.rizer import Rizer | ||
|
||
""" make sure the rizer is connected to a fitness machine otherwise the steering angle will not be transmitted """ | ||
|
||
|
||
async def run(address): | ||
async with BleakClient(address) as client: | ||
def steering_handler(steering_angle): | ||
print(steering_angle) | ||
|
||
await client.is_connected() | ||
rizer = Rizer(client) | ||
rizer.set_steering_measurement_callback(steering_handler) | ||
await rizer.enable_steering_measurement_notifications() | ||
await rizer.set_transmission_rate(0) # 8 Hz | ||
await asyncio.sleep(4) | ||
await rizer.set_transmission_rate(1) # 16 Hz | ||
await asyncio.sleep(4) | ||
await rizer.set_transmission_rate(2) # 32 Hz | ||
await asyncio.sleep(4) | ||
# recalibrate the rizer | ||
#await rizer.set_center() | ||
|
||
if __name__ == "__main__": | ||
import os | ||
|
||
os.environ["PYTHONASYNCIODEBUG"] = str(1) | ||
|
||
device_address = "YOUR RIZER ADDRESS HERE" | ||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(run(device_address)) |
Oops, something went wrong.