API Reference

First Class functions

connect_commands(url)

Establishes a connection to the RcWebApi Commands Socket and returns CommandServer object which can be used to interact with the socket.

connect_subscriber(url)

Establishes a connection to the RcWebApi Subscribe Socket and returns SubscribeServer object which can be used to interact with the socket.

get_variable(cmd_server, prefix, name)

Returns the value of a given variable on the PLC

create_variable_getter(cmd_server, prefix)

Creates a function to get variable values with a fixed prefix and server.

set_variable(cmd_server, prefix, name, val)

Sets a variable on the PLC

create_variable_setter(cmd_server, prefix)

Creates a function to set variable values with a fixed prefix and server.

CommandServer

CommandServer()

Holds the connection to the RcWebApi's command socket.

CommandServer.disconnect()

Disconnects from the socket.

CommandServer.is_connected()

Returns whether the socket is connected or not.

CommandServer.start(cmd, **kwargs)

Sends the given command and it's parameters to the PLC returns a ticket

CommandServer.exec(cmd, **kwargs)

Sends the given command and it's parameters to the PLC and waits till it's finished.

Ticket

Ticket(server, id)

A Ticket represents one command sent to the socket.

Ticket.wait([timeout])

Waits and blocks until the ticket is completed or the timeout is reached.

Ticket.requestid()

Unique request id for this ticket.

Ticket.state

Current state of the Ticket

SubscribeServer

SubscribeServer()

Holds the connection to the RcWebApi's subscribe socket.

SubscribeServer.disconnect()

Unsubscribes from all active subscriptions and closes the connection to the socket.

SubscribeServer.is_connected()

Returns whether the socket ist connected or not.

SubscribeServer.subscribe(topic[, func, ...])

Subscribes to a topic.

SubscribeServer.unsubscribe(topic[, func])

Unsubscribe from a previously subscribed topic.

Compatibility Layer

As some functions is not present in RcWebApi beta the compatibility layer provides functionality to connect to the TcWebApi to achive those functions. This is a temporary fix while RcWebApi is still in beta and will be removed in the future.

connect_tc_var(host, user, passwd)

Establishes a connection to the TcApi and returns a instance of TcVar which can be used to set and get variables via Teach Control

TcVar.set_var(path, val)

Sets a Variable on the PLC via the TcApi

TcVar.get_var(path)

Gets a Variable from the PLC via the TcApi

connect_tc_prog(host, user, passwd, robot)

Establishes a connection to the TcApi and returns a instance of TcProg which can be used to start and stop programs that are already definen in Teach Control

TcProg.exec(project_name, prog_name)

Starts a Teach Control programm and waits until it's execution is finished.

TcProg.start(project_name, prog_name)

Loads and starts a Teach Control program.

TcProg.stop()

Stops the currently executing program and unloads the Teach Control project.

TcProg.load_project(project_name)

Loads a Teach Control Project

TcProg.unload_project()

Unloads the currently loaded Teach Control project

TcProg.is_prog_running()

Returns whether a program is running or not