1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
|
<p align="center"><img src="https://raw.githubusercontent.com/robotraconteur/robotraconteur/master/docs/figures/logo-header.svg"></p>
# robotraconteur Python Package



[](https://github.com/robotraconteur/robotraconteur/actions/workflows/main.yml)
A communication framework for robotics, automation, and the Internet of Things
[http://robotraconteur.com](http://robotraconteur.com)
[J. Wason and J. T. Wen, "Robot Raconteur Updates on an Open Source Interoperable Middleware for Robotics", in Proc. IEEE Conference on Automation Science and Engineering, 2023, pp. 1-8.](https://files2.wasontech.com/RobotRaconteur_CASE2023.pdf)
Github Repository: https://github.com/robotraconteur/robotraconteur
## Introduction
Robot Raconteur is a powerful communication framework for robotics and automation systems. While intended for use with robotics, it is flexible enough to be used for other applications, including building control, infrastructure, and Internet-of-Things applications, among many others. This package
contains the Robot Raconteur Core library for Python.
## Installation
For most platforms, the easiest way to install Robot Raconteur is using `pip`:
```bash
python -m pip install robotraconteur
```
Packages are available from pip for Python 3.6 and later for Windows (x86,x64), macOS (x64,arm64) and Linux (x64,arm64).
Use `python3` instead of `python` if you are using Ubuntu or other Linux distributions.
It may be necessary to update `pip` before installing on older Linux distributions:
```bash
sudo python3 -m pip install --upgrade pip
```
Conda packages are also available from the `conda-forge` channel:
```bash
conda install -c conda-forge robotraconteur
```
It is highly recommended that the `robotraconteurcompanion` package is also installed.
```bash
python -m pip install robotraconteur robotraconteurcompanion
```
Or with Conda:
```bash
conda install -c conda-forge robotraconteur robotraconteur_companion_python
```
For other installation options, see the [installation instructions](https://github.com/robotraconteur/robotraconteur/blob/master/docs/common/installation.md).
## Documentation
See the [Robot Raconteur Documentation](https://github.com/robotraconteur/robotraconteur/wiki/Documentation)
See the [Robot Raconteur Examples](https://github.com/robotraconteur/robotraconteur/tree/master/examples)
## Quick Start
The Quick Start example demonstrates the basic functionality of Robot Raconteur be creating a service,
and then calling the service using a client. This example uses the "Reynard the Robot" Python package,
which provides a simple cartoon robot.
`reynard_quickstart_service.py`
```python
import RobotRaconteur as RR
RRN = RR.RobotRaconteurNode.s
import threading
import reynard_the_robot
# Define the service definition for the quickstart service
reynard_quickstart_interface = """
service experimental.reynard_quickstart
object ReynardQuickstart
function void say(string text)
function void teleport(double x, double y)
end
"""
# Implement the quickstart service
class ReynardQuickstartImpl(object):
def __init__(self):
self.reynard = reynard_the_robot.Reynard()
self.reynard.start()
self._lock = threading.Lock()
def say(self, text):
with self._lock:
self.reynard.say(text)
def teleport(self, x, y):
with self._lock:
self.reynard.teleport(x, y)
with RR.ServerNodeSetup("experimental.minimal_create2", 53222):
# Register the service type
RRN.RegisterServiceType(reynard_quickstart_interface)
reynard_inst = ReynardQuickstartImpl()
# Register the service
RRN.RegisterService("reynard", "experimental.reynard_quickstart.ReynardQuickstart", reynard_inst)
# Wait for program exit to quit
input("Press enter to quit")
```
To run the service, execute the following command:
```bash
python reynard_quickstart_service.py
```
And open a browser to [http://localhost:29201](http://localhost:29201) to view the Reynard user interface.
This service can now be called by a connecting client. Because of the magic of Robot Raconteur, it is only necessary to connect to the service to utilize its members. In Python and MATLAB there is no boilerplate code, and in the other languages the boilerplate code is generated automatically.
`reynard_quickstart_client.py`
```python
from RobotRaconteur.Client import *
# RRN is imported from RobotRaconteur.Client
# Connect to the service.
obj = RRN.ConnectService('rr+tcp://localhost:53222/?service=reynard')
# Call the say function
obj.say("Hello from Reynard!")
# Call the teleport function
obj.teleport(100, 200)
```
To run the client, execute the following command:
```bash
python reynard_quickstart_client.py
```
## License
Apache 2.0
## Support
Please report bugs and issues on the [GitHub issue tracker](https://github.com/robotraconteur/robotraconteur/issues).
Ask questions on the [Github discussions](https://github.com/robotraconteur/robotraconteur/discussions).
## Acknowledgment
This work was supported in part by Subaward No. ARM-TEC-18-01-F-19 and ARM-TEC-19-01-F-24 from the Advanced Robotics for Manufacturing ("ARM") Institute under Agreement Number W911NF-17-3-0004 sponsored by the Office of the Secretary of Defense. ARM Project Management was provided by Christopher Adams. The views and conclusions contained in this document are those of the authors and should not be interpreted as representing the official policies, either expressed or implied, of either ARM or the Office of the Secretary of Defense of the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for Government purposes, notwithstanding any copyright notation herein.
This work was supported in part by the New York State Empire State Development Division of Science, Technology and Innovation (NYSTAR) under contract C160142.
|