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
class LruCache<T> { | |
private values = new Map<string, T>(); | |
constructor(private maxEntries = 10) {} | |
public get(key: string): T | undefined { | |
const entry = this.values.get(key); | |
if (entry != undefined) { | |
this.values.delete(key); | |
this.values.set(key, entry); |
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
FROM ubuntu:focal | |
ARG USER=jhurliman | |
ARG BASE_DIR=/home/$USER/Documents/Code/ros2/ros2_galactic | |
SHELL ["/bin/bash", "-c"] | |
ENV DEBIAN_FRONTEND noninteractive | |
RUN apt-get update && apt-get install -y locales | |
RUN locale-gen en_US en_US.UTF-8 |
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 Source Code Form is subject to the terms of the Mozilla Public | |
// License, v2.0. If a copy of the MPL was not distributed with this | |
// file, You can obtain one at http://mozilla.org/MPL/2.0/ | |
import { produce } from "immer"; | |
import { | |
SettingsTreeAction, | |
SettingsTreeNode, | |
SettingsTreeRoots, |
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
FROM ros:noetic-ros-core-focal | |
# Install dependencies for depthai, ros, and build | |
RUN apt-get update && apt-get install -y \ | |
build-essential \ | |
cmake \ | |
git \ | |
libjpeg-dev \ | |
libopencv-dev \ | |
libpng-dev \ |
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
import * as THREE from "three"; | |
type UserData = { [key: string]: unknown }; | |
const INITIAL_SIZE = 4; | |
const tempMat4 = new THREE.Matrix4(); | |
const tempColor = new THREE.Color(); | |
/** |
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
# volatile, no history | |
ros2 topic pub -r 0.5 --qos-durability volatile --qos-reliability reliable /chatter std_msgs/msg/String '{data: hello}' | |
# transient_local, history of 5 | |
ros2 topic pub -r 0.5 --qos-durability transient_local --qos-reliability reliable --qos-depth 5 --qos-history keep_last /chatter std_msgs/msg/String '{data: hello}' | |
# foxy compatible transient_local | |
ros2 topic pub -r 0.5 --qos-durability transient_local --qos-reliability reliable /chatter std_msgs/msg/String '{data: hello}' | |
# /tf_static |
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
import { PanelExtensionContext, Topic, MessageEvent } from "@foxglove/studio"; | |
import { useLayoutEffect, useState } from "react"; | |
import ReactDOM from "react-dom"; | |
function ExamplePanel({ context }: { context: PanelExtensionContext }): JSX.Element { | |
const [topics, setTopics] = useState<readonly Topic[] | undefined>(); | |
const [messages, setMessages] = useState<readonly MessageEvent<unknown>[] | undefined>(); | |
// We use a layout effect to setup render handling for our panel. We also setup some topic subscriptions. | |
useLayoutEffect(() => { |
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
export type UTM = { | |
easting: number; | |
northing: number; | |
zoneNumber: number; | |
}; | |
export function LatLngToUtm( | |
lat: number, | |
lng: number, | |
zoneNumber?: number, |
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
import { TransformStream, TransformerTransformCallback } from "web-streams-polyfill/ponyfill"; | |
class TcpMessageStreamImpl { | |
private _inMessage = false; | |
private _bytesNeeded = 4; | |
private _chunks: Uint8Array[] = []; | |
transform: TransformerTransformCallback<Uint8Array, Uint8Array> = (chunk, controller) => { | |
let idx = 0; | |
while (idx < chunk.length) { |
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
#pragma once | |
#include <nvToolsExt.h> | |
#include <string> | |
struct NvtxRange { | |
NvtxRange() = delete; | |
explicit NvtxRange(const std::string_view name) { nvtxRangePush(name.data()); } |