This is a simple Python Interface to use the Xiron Simulator
- Make sure you have python installed on your system. Python can be installed from here
- Install pip to manage dependencies. Instructions are available here
- Use pip to install the module. To install it directly from github:
pip install git+https://github.com/SuhrudhSarathy/xironpy.git
- To install from source, clone the repository and use pip to install
git clone https://github.com/SuhrudhSarathy/xironpy.git
cd xironpy
pip install -e .
A simple script can be found in examples
from xiron_py.comms import XironContext
from xiron_py.data import Twist
from time import sleep
def scan_callback(msg):
print(f"Recieved Scan message: {msg}")
def pose_callback(msg):
print(f"Recieved Pose message: {msg}")
if __name__ == "__main__":
# Create a context object
ctx = XironContext()
# Create the Velocity publisher for robot0
vel_pub = ctx.create_vel_publisher("robot0")
# Create the Scan Subscriber and add callback function
ctx.create_scan_subscriber("robot0", scan_callback)
# Create the Pose Subscriber and add callback function
ctx.create_pose_subscriber("robot0", pose_callback)
twist_message = Twist("robot0", [0.1, 0.0], 0.1)
for i in range(100):
vel_pub.publish(twist_message)
print("Publihsed vel: ", i)
sleep(0.1)
twist_message = Twist("robot0", [0.0, 0.0], 0.0)
vel_pub.publish(twist_message)
print("Done!")
Documentation can be found here