-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'humble' of github.com:luxonis/rae-ros into spectacular_sdk
- Loading branch information
Showing
25 changed files
with
390 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.git | ||
.github | ||
.devcontainer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# RAE ROS | ||
|
||
This repository contains rae [ROS](https://www.ros.org/) integration files. | ||
This repository contains rae [ROS](https://www.ros.org/) integration files. | ||
**Note** The RAE project is under active development so you can expect changes in the API and improvements in the performance in near future. Please report problems on Github issues as it's important for the development efforts. | ||
|
||
### Setting up procedure | ||
|
||
|
@@ -9,7 +10,8 @@ This repository contains rae [ROS](https://www.ros.org/) integration files. | |
1. Connect via USB cable or wifi `rae-<ID>`, password `wifiwifi@` (See [rae getting started documentation](https://docs.luxonis.com/projects/hardware/en/latest/pages/rae/#getting-started)). | ||
2. To use SHH without typing password each time - `ssh-copy-id [email protected]` | ||
3. Currently date resets after each startup to set current - ssh [email protected] sudo date -s @`( date -u +"%s" )` | ||
4. If you want to run ROS packages while bypassing RobotHub it would be advised to stop RH agent before starting docker containers, otherwise you can easily run into conflicts as they would be competing for same hardware resources - `robothub-ctl stop` | ||
4. If you want to run ROS packages while bypassing RobotHub it would be advised to stop RH agent before starting docker containers, otherwise you can easily run into conflicts as they would be competing for same hardware resources - `robothub-ctl stop`. **Keep in mind** that since `wpa_supplicant` is a subproccess of the RH agent, the WiFi connection will get killed along with the agent. To resolve this we recommend you manually setup the WiFi connection as done in [this guide](https://docs-beta.luxonis.com/deploy/connect-device/rae/?v=Advanced+%28manual%29). | ||
|
||
|
||
#### Generating docker image | ||
|
||
|
@@ -196,4 +198,5 @@ Microphone node expects audio messages and example of how to use that data (alon | |
audio_data = audio_data.reshape((msg.frames, msg.channels)) | ||
``` | ||
|
||
Speakers operate similarly, in that they output audio messages. In bringup package in scripts folder sound_test.py offers a decent example of how you can create audio messages. We will shortly create more demos for speakers and microphone. | ||
|
||
Speakers operate similarly, in that they output audio messages. In bringup package in scripts folder sound_test.py offers a decent example of how you can create audio messages. We will shortly create more demos for speakers and microphone. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# setup ros environment | ||
echo 2 > /sys/class/pwm/pwmchip0/export && echo 1 > /sys/class/pwm/pwmchip0/export && chmod -R a+rw /sys/class/pwm/pwmchip0/pwm1/ && chmod -R a+rw /sys/class/pwm/pwmchip0/pwm2/ && chmod -R a+rw /dev/gpiochip0 | ||
# Check and export pwm channels if not already exported | ||
for channel in 1 2; do | ||
pwm="/sys/class/pwm/pwmchip0/pwm${channel}/" | ||
if [ ! -d ${pwm} ]; then | ||
echo ${channel} > /sys/class/pwm/pwmchip0/export | ||
fi | ||
chmod -R a+rw ${pwm} | ||
done | ||
|
||
chmod -R a+rw /dev/gpiochip0 | ||
|
||
source "/opt/ros/$ROS_DISTRO/setup.bash" | ||
source "/ws/install/setup.bash" | ||
source "$HOME/.bashrc" | ||
exec "$@" | ||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#!/usr/bin/env python3 | ||
import rclpy | ||
from rclpy.node import Node | ||
from rclpy.time import Time | ||
|
||
from std_msgs.msg import ColorRGBA | ||
from rae_msgs.msg import LEDControl | ||
from cv_bridge import CvBridge | ||
from geometry_msgs.msg import Twist | ||
|
||
blinking = True | ||
|
||
class CarDemoNode(Node): | ||
|
||
def __init__(self): | ||
super().__init__('car_demo_node') | ||
self.subscription = self.create_subscription( | ||
Twist, | ||
'cmd_vel', | ||
self.listener_callback, | ||
10) | ||
self.publisher_led = self.create_publisher(LEDControl, 'leds', 10) | ||
|
||
self.bridge = CvBridge() | ||
|
||
def listener_callback(self, msg): | ||
global blinking | ||
linear_speed = msg.linear.x | ||
angular_speed = msg.angular.z | ||
|
||
|
||
# Set LEDs based on battery level | ||
# Define colors for LEDs | ||
colors = { | ||
"white": ColorRGBA(r=1.0, g=1.0, b=1.0, a=1.0), | ||
"yellow": ColorRGBA(r=1.0, g=1.0, b=0.0, a=1.0), | ||
"red": ColorRGBA(r=1.0, g=0.0, b=0.0, a=1.0), | ||
"blue": ColorRGBA(r=0.0, g=0.0, b=1.0, a=1.0) | ||
} | ||
|
||
|
||
|
||
# Create and publish LEDControl message for each LED | ||
led_msg = LEDControl() | ||
led_msg.header.stamp = self.get_clock().now().to_msg() | ||
led_msg.data = [ColorRGBA(r=0.0, g=0.0, b=0.0, a=0.0)]*40 | ||
for i in range(39): | ||
led_msg.single_led_n = 0 | ||
led_msg.control_type = 2 | ||
if i < 8: | ||
color = "white" | ||
led_msg.data[i]=(colors[color]) | ||
if i >9 and i < 14 and angular_speed > 0.0 and blinking==True: | ||
color = "yellow" | ||
led_msg.data[i]=(colors[color]) | ||
if i > 20 and i < 29 and linear_speed < 0.0: | ||
color = "red" | ||
led_msg.data[i]=(colors[color]) | ||
if i> 34 and i < 39 and angular_speed < 0.0 and blinking==True: | ||
color = "yellow" | ||
led_msg.data[i]=(colors[color]) | ||
|
||
blinking = not blinking | ||
self.publisher_led.publish(led_msg) | ||
|
||
|
||
def main(args=None): | ||
rclpy.init(args=args) | ||
|
||
car_demo_node = CarDemoNode() | ||
|
||
rclpy.spin(car_demo_node) | ||
|
||
# Destroy the node explicitly | ||
car_demo_node.destroy_node() | ||
rclpy.shutdown() | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.