Skip to content

Use with AI

Use with AI

Example programs XML/RPC ​

The sample programs provided here are intended solely as a basis for creating your own program. There is no guarantee of correctness and completeness.

This article is both valid for all horstOS and horstFX versions.

1. C# ​

This section includes a sample program for remotely controlling the robot using a script in the C# programming language.

C# Example

2. Python 3: Establishing a Connection with the Robot ​

This section explains how to establish a connection with the robot using XML-RPC in the Python 3 programming language. Before establishing a connection with the robot, it is necessary to know the IP address. The article "Changing IP Address" describes how to retrieve and adjust the robot's IP address if needed.

2.1 Establishing a Connection ​

To establish a connection using XML-RPC, the first step is to import the following:

import xmlrpc.client

Next, you can establish a connection with the robot by using the following class.

class Client:
 
    def __init__(self, user="horstFX", password="WZA3P9", url="127.0.0.1:8080/xml-rpc"):
        self.URL = "@" + url
        self.USERNAME = user
        self.PASSWORD = password
        self.client = xmlrpc.client.ServerProxy("http://" + self.USERNAME + ":" + self.PASSWORD + self.URL)
        print("Initialized xmlrpc client for user '" + self.USERNAME + "'")

Basic Authentification is used for HTTP authentication. If the connection cannot be established successfully, the following error is displayed

Server returned a fault exception: [0] Not authorized

2.2 Example Program ​

horstFXClient