RAE SDK
Requirements
- Upgrade your robot's firmware to the latest version (Luxonis OS 1.14).
After firmware update you could still see an option to upgrade to the latest version. This is a known issue and you can safely ignore it. As long as you have Luxonis OS 1.14 installed and Agent version 23.223.1855, you are good to go.
- Specify correct image in robotapp.toml file. As of the moment of writing this guide, latest image is
ghcr.io/luxonis/rae-ros:v0.2.2-humble.
Robot
Robot class is the main entry point for the SDK. It provides access to all the robot's components and allows you to control them. It contains following properties (more on them in later sections):- ROS Interface
- LED
- Display
- Audio
- Movement
- Perception system
Python
1from rae_sdk.robot import Robot
2
3robot = Robot()Robot Options
Python
1from rae_sdk.robot import Robot, RobotOptions
2
3options = RobotOptions(name='rae_sdk', namespace='', launch_controllers=True, start_hardware=True, launch_mock=False)
4
5robot = Robot(options)name- name of the ROS node that will be created by the Robot class. Default:rae_sdknamespace- namespace of the ROS node that will be created by the Robot class. Default:''launch_controllers- whether to initialize SDK Components such as LED, Display, Audio, Navigation, State. Default:Truelaunch_mock- whether to launch mock hardware drivers instead of real ones, mostly used for testing. Default:Falsestart_hardware- whether to start hardware drivers for peripherals and wheels. Default:True
robot.stop() at the end of your program.SDK Components
LED
Python
1from rae_sdk.robot import Robot
2
3robot = Robot()
4
5robot.led.set_leds('#FF0000', 100, 'solid', 1) # set color to redPython
1from rae_sdk.robot import Robot
2from rae_msgs.msg import LEDControl, ColorPeriod
3
4robot = Robot()
5
6led_control = LEDControl()
7
8color_msg = ColorPeriod()
9color_msg.frequency = 1.0
10color_msg.color.a = 1.0
11color_msg.color.r = 1.0
12color_msg.color.g = 0.0
13color_msg.color.b = 0.0
14led_msg.data = [color_msg]
15
16led_msg.control_type = LEDControl.CTRL_TYPE_ALL
17
18robot.set_leds_from_msg(led_msg)Display
Python
1import cv2
2from rae_sdk.robot import Robot
3
4robot = Robot()
5
6img = cv2.imread('image.jpg')
7robot.display.display_image(img)Audio
Python
1from rae_sdk.robot import Robot
2
3robot = Robot()
4
5robot.audio.play_audio_file('file.mp3')Navigation
Python
1from rae_sdk.robot import Robot
2
3robot = Robot()
4
5robot.navigation.move(0.5, 0.5) # move forward with 0.5 m/s speed and 0.5 rad/s angular speed
6
7position = robot.navigation.get_odom_position()State
Python
1from rae_sdk.robot import Robot
2
3robot = Robot()
4
5battery_level = robot.state.battery_state.capacityROS Interface
rclpy library to spin up its own executor and node for communication with ROS2. It also uses ROS2 launch system to bring up robot nodes. It is abstracted away from the user, but it is possible to access it via robot.ros_interface property. For example, let's create a publisher that publishes a message to /test_topic topic with a frequency of 1 Hz:Python
1from rae_sdk.robot import Robot
2from std_msgs.msg import String
3
4robot = Robot()
5
6def timer_callback():
7 msg = String()
8 msg.data = 'Hello world!'
9 robot.ros_interface.publish('/test_topic', msg)
10
11robot.ros_interface.create_publisher('/test_topic', String)
12robot.ros_interface.create_timer(1.0, timer_callback)/test_topic topic:Python
1from rae_sdk.robot import Robot
2from std_msgs.msg import String
3
4def callback(msg):
5 print(msg.data)
6
7robot = Robot()
8
9robot.ros_interface.create_subscription('/test_topic', String, callback)Python
1from rae_sdk.robot import Robot
2from std_srvs.srv import Trigger
3
4robot = Robot()
5
6robot.ros_interface.create_service_client('/test_service', Trigger)
7robot.ros_interface.call_async_srv('/test_service', Trigger.Request())Python
1from rae_sdk.robot import Robot
2from example_interfaces.action import Fibonacci
3
4def feedback_callback(feedback_msg):
5 print('Feedback received:', feedback_msg.feedback.sequence)
6
7def result_callback(future):
8 result = future.result().result
9 print('Result received:', result.sequence)
10
11robot = Robot()
12
13robot.ros_interface.create_action_client('/test_action', Fibonacci)
14robot.ros_interface.call_async_action("/fibonacci", Fibonacci.Goal(order=10), None, self.result_cb, self.feedback_cb)
15
16# cancel the goal robot.ros_interface.cancel_action("/fibonacci")Resources
assets folder of the SDK. For now those resources include a set of face images for the robot and some example audio files that can be used for basic interaction.