Skip to content

Instantly share code, notes, and snippets.

@danielcranston
danielcranston / rebroadcastable_static_transform_publisher.py
Created October 29, 2025 06:31
ReBroadcastableStaticTransformBroadcaster
from tf2_ros.static_transform_broadcaster import StaticTransformBroadcaster
class ReBroadcastableStaticTransformBroadcaster(StaticTransformBroadcaster):
"""
In ROS 2 Jazzy, StaticTransformBroadcaster does not allow updating an already sent
static TF. This class provides a workaround. See https://github.com/ros2/geometry2/issues/704.
While the authorative take in the previous issue is that disallowing updating is correct
behavior (I personally disagree ^^), a separate PR has since been merged into Rolling that
goes back to allowing updating. See https://github.com/ros2/geometry2/pull/820.
@danielcranston
danielcranston / service_from_service.py
Created October 22, 2025 08:26 — forked from driftregion/service_from_service.py
Calling a ROS2 service from the callback of another service
import time
from threading import Event
from example_interfaces.srv import AddTwoInts
import rclpy
from rclpy.node import Node
from rclpy.callback_groups import ReentrantCallbackGroup
from rclpy.executors import MultiThreadedExecutor, SingleThreadedExecutor
@danielcranston
danielcranston / least_squares_rectangle.py
Created October 21, 2024 13:35
least_squares_rectangle.py
import numpy as np
import matplotlib.pyplot as plt
import scipy
import cv2
class Rectangle:
def __init__(self, x, y, width, height, phi):
self.centroid = np.array([x, y])
self.width, self.height = width, height
@danielcranston
danielcranston / keybindings.json
Created October 10, 2024 08:35
VSCode keybindings.json
[
{
"key": "ctrl+tab",
"command": "workbench.action.nextEditorInGroup"
},
{
"key": "ctrl+shift+tab",
"command": "workbench.action.previousEditorInGroup"
},
{
@danielcranston
danielcranston / cuda_install_quick_reference.md
Last active March 27, 2025 11:08
CUDA Install Quick Reference (Ubuntu)