Skip to content

Instantly share code, notes, and snippets.

View chrismatthieu's full-sized avatar
🚀
Hacking the metaverse!

Chris Matthieu chrismatthieu

🚀
Hacking the metaverse!
View GitHub Profile
@chrismatthieu
chrismatthieu / robot.js
Last active February 11, 2025 21:11
Sample robotics.dev boiler plate code
//import robotics from 'robotics-dev';
const robotics = require('robotics-dev');
// Define ROS twist movement commands
const moveForward = {
linear: {x: 0.2, y: 0.0, z: 0.0},
angular: {x: 0.0, y: 0.0, z: 0.0}
};
const turnLeft = {
linear: {x: 0.0, y: 0.0, z: 0.0},
@chrismatthieu
chrismatthieu / Boards.h
Created November 7, 2024 16:18
Radxa X4 Firmata
// Raspberry Pi Pico
// https://datasheets.raspberrypi.org/pico/Pico-R3-A4-Pinout.pdf
#elif defined(TARGET_RP2040) || defined(TARGET_RASPBERRY_PI_PICO)
#define TOTAL_ANALOG_PINS 4
#define TOTAL_PINS 30
#define VERSION_BLINK_PIN LED_BUILTIN
#define IS_PIN_DIGITAL(p) (((p) >= 0 && (p) < 23) || (p) == LED_BUILTIN)
#define IS_PIN_ANALOG(p) ((p) >= 26 && (p) < 26 + TOTAL_ANALOG_PINS)
#define IS_PIN_PWM(p) digitalPinHasPWM(p)
#define IS_PIN_SERVO(p) (IS_PIN_DIGITAL(p) && (p) != LED_BUILTIN)
@chrismatthieu
chrismatthieu / obstacle-avoidance.py
Created October 23, 2024 20:08
Intel RealSense Robot Obstacle Avoidance
#!/usr/bin/env python3
import rclpy
from rclpy.node import Node
from geometry_msgs.msg import Twist
import pyrealsense2 as rs
import numpy as np
class ObstacleAvoidanceRobot(Node):
def __init__(self):
print("hello world")
echo "Hello world!"
@chrismatthieu
chrismatthieu / person_detection.py
Created September 30, 2024 16:30
realsense person detection and follow me
import sys
import rclpy
from rclpy.node import Node
from geometry_msgs.msg import Twist
import cv2
import numpy as np
import pyrealsense2 as rs
from ultralytics import YOLO
def check_dependencies():
@chrismatthieu
chrismatthieu / detect_person.py
Created August 28, 2024 22:43
D421 Person Detection
import pyrealsense2 as rs
import numpy as np
import cv2
# Load YOLOv3 model
net = cv2.dnn.readNet("yolov3.weights", "yolov3.cfg")
layer_names = net.getLayerNames()
output_layers = [layer_names[i - 1] for i in net.getUnconnectedOutLayers().flatten()]
# Load COCO class labels
import pyrealsense2 as rs
import numpy as np
import cv2
import requests
import http.client
import json
# Configure depth and color streams
pipeline = rs.pipeline()
config = rs.config()
root@1c61c6f03539:/opt/ros/humble/share/realsense2_camera/launch# ros2 launch realsense2_camera rs_launch.py
[INFO] [launch]: All log files can be found below /root/.ros/log/2024-03-29-20-10-16-331349-1c61c6f03539-3984
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [realsense2_camera_node-1]: process started with pid [3985]
[realsense2_camera_node-1] [INFO] [1711743016.484734986] [camera.camera]: RealSense ROS v4.54.1
[realsense2_camera_node-1] [INFO] [1711743016.484882040] [camera.camera]: Built with LibRealSense v2.54.1
[realsense2_camera_node-1] [INFO] [1711743016.484907207] [camera.camera]: Running with LibRealSense v2.54.1
[realsense2_camera_node-1] 29/03 20:10:16,486 ERROR [140732102732000] (librealsense-exception.h:52) Cannot identify '/dev/video0 Last Error: No such file or directory
[realsense2_camera_node-1] 29/03 20:10:16,486 ERROR [140732102732000] (librealsense-exception.h:52) Cannot identify '/dev/video1 Last Error: No such file or directory
[realsense2_camera_node-1] 29/03
import network
from time import sleep
import machine
from picozero import LED
from picozero import Button
import requests
import utime
blue = LED(13)