The official python client interface for ProtoTwin Connect.
Project description
ProtoTwin Connect Client
This package provides a simple client that can be used to interface with ProtoTwin Connect.
Basic Example
# STEP 1: Import the ProtoTwin client
import prototwin
import asyncio
import math
# STEP 2: Define your signal addresses (obtain these from your ProtoTwin model)
simulation_time_address = 0
motor_target_velocity_address = 3
async def main():
# STEP 3: Start ProtoTwin Connect
client = await prototwin.start()
# STEP 4: Create the simulation loop
while True:
t = client.get(simulation_time_address) # Read signal values
client.set(motor_target_velocity_address, math.sin(t)) # Write signal values
await client.step() # Step the simulation forward in time
asyncio.run(main()) # Run the simulation loop
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
prototwin-0.1.15.tar.gz
(4.9 kB
view details)
File details
Details for the file prototwin-0.1.15.tar.gz
.
File metadata
- Download URL: prototwin-0.1.15.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd10e29b853bba1aab0b8e1f1ab4a20fa97b8b207862485421f218020819cb89 |
|
MD5 | d2d3cb9de06c82b2a1be4a7e831349c2 |
|
BLAKE2b-256 | df0689904af7f96792df300ef06db37eaba8e26c596415cd1f4467eb7e76cf7f |