Skip to content

Instantly share code, notes, and snippets.

@vyeevani
vyeevani / cybergear.rs
Last active August 15, 2025 19:21
Single file implementation of cyber gear comms. Tested on 6dof arm.
use std::{f32::consts::PI, marker::PhantomData};
use serial::prelude::*;
pub enum Register {
MechOffset = 0x2005,
MechPositionInit = 0x2006,
CanId = 0x200A,
EncoderRaw = 0x3004,
NumRotations = 0x3014,
MechanicalPosition = 0x3016,
@vyeevani
vyeevani / modern_robotics.rs
Created May 4, 2024 17:30
A rust single file implementation of the core functions from modern robotics. The only dependency is nalgebra :)
use nalgebra::{Matrix3, Matrix4, Matrix6, Vector3, Vector4, Vector6, DMatrix, DVector};
fn near_zero(val: f64) -> bool {
val.abs() < 1e-6
}
fn matrix_exp3(so3mat: &Matrix3<f64>) -> Matrix3<f64> {
let omega_theta = so3_to_vec(so3mat);
if near_zero(omega_theta.norm()) {
Matrix3::identity()
@vyeevani
vyeevani / bridge_dataset.py
Last active August 22, 2023 23:01
A torch dataset for the scripted bridge dataset. This has only been (poorly) tested on the scripted bridge dataset so far. Feel free to modify with whatever params you'd like to extract.
# Interaction imports
import math
import copy
import os
from dataclasses import dataclass
from typing import List
from tqdm import tqdm
# Dataset imports
from PIL import Image
@vyeevani
vyeevani / equinox_lazy_downloading.py
Last active May 23, 2023 15:47
Demonstrating how to run an equinox model with lazy download/data-loading through webdatasets + pytorch multiprocessed dataloader
import sys
import datetime
import importlib
import signal
import numpy
import datasets
import webdataset
import tensorflow
import torch
@vyeevani
vyeevani / kinetics_webdataset_jax.py
Last active May 23, 2023 02:53
Kinetics Jax dataloader
# https://s3.amazonaws.com/kinetics/400/train/part_0.tar.gz
# https://s3.amazonaws.com/kinetics/400/train/part_241.tar.gz
import webdataset as wds
import pandas as pd
import jax
def key_to_filename(sample):
dotslash_filename_shard_count = sample["__key__"]
# the key is something like "./v_ApplyEyeMakeup_00001_00010"