Python Module
Reference for using Freedom Robotics Link with pure Python (non-ROS).
Supported Versions:
- Python 2.7
- Python 3.6+
Install
#!/usr/bin/env python
from freedomrobotics.link import Link
# Connect to the SDK using credentials
freedom = Link(name="core")
Send Data
Logs
freedom.log("info", "Low power")
Log levels:
INFO
WARN
ERROR
FATAL
Send a Message
This is a core method of Link and adds a message with a defined topic name and type to the queue to be synchronized with the cloud:
freedom.message("/topic", "topic_type", {"key": "value"} )
Send an Image
#!/usr/bin/env python
from freedomrobotics.link import Link
import cv2
# Connect to the SDK using credentials
freedom_link = Link(name="core")
# Use CV2 to load an image as <type 'numpy.ndarray'>
image = cv2.imread('/users/me/Desktop/image.jpg')
# image.shape is assumed to be (height, width, channel depth)
# Upload the image to a topic name to Freedom.
freedom_link.image('/camera/front', image)
Receive Commands
#!/usr/bin/env python
from freedomrobotics.link import Link
def callback(msg):
print(msg)
# Connect to the SDK using credentials
freedom_link = Link(name="core", command_callback=callback)
You can receive commands from the App through Pilot mode, Commands, and other places, or trigger them programmatically through the API by sending them to /commands
on the data
endpoint.
Updated about 4 years ago