Metadata-Version: 2.4
Name: prototwin
Version: 0.2.2
Summary: The official python client interface for ProtoTwin Connect.
Home-page: https://prototwin.com
Author: ProtoTwin
License: MIT
Keywords: Industrial Simulation,Physics,Machine Learning,Robotics
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: asyncio
Requires-Dist: websockets
Requires-Dist: prototwin_cmdbuff
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: summary

# 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 os
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, load and initialize the model
    path = os.path.join(os.path.dirname(__file__), "example.ptm")
    client = await prototwin.start()
    await client.load(path)
    await client.initialize()

    # 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
```
