Skip to content

Instantly share code, notes, and snippets.

View cohnt's full-sized avatar

Thomas Cohn cohnt

View GitHub Profile
import numpy as np
import time
from pydrake.all import (
StartMeshcat,
RigidTransform,
RotationMatrix
)
meshcat = StartMeshcat()
@cohnt
cohnt / main.py
Last active September 17, 2024 17:37
Inertia Error
import os
from pydrake.all import (
StartMeshcat,
DiagramBuilder,
AddMultibodyPlantSceneGraph,
Parser,
LoadModelDirectivesFromString,
ProcessModelDirectives,
)
import numpy as np
import matplotlib.pyplot as plt
from sklearn.neighbors import kneighbors_graph
from collections import deque
def adj_mat_to_adj_list(adj_mat):
return [list(np.where(adj_mat[i] != 0)[0]) for i in range(adj_mat.shape[0])]
def edge_set_to_adj_mat(edge_set, n_points):
# Takes in a set of edges, and the number of points, and outputs an adjacency
@cohnt
cohnt / maze_new.py
Last active July 3, 2024 18:20
KinematicTrajectoryOptimization Non-Determinism
# In[2]:
import numpy as np
import os
import pydot
from IPython.display import display, Image, SVG
from tqdm import tqdm
@cohnt
cohnt / maze_new.py
Last active July 3, 2024 18:20
Box Box Problem Reproduction
# In[2]:
import numpy as np
import os
import pydot
from IPython.display import display, Image, SVG
from tqdm import tqdm
@cohnt
cohnt / A.npy
Last active June 11, 2024 20:28
Drake Affine Hull of HPolyhedron Check
This file has been truncated, but you can view the full file.
@cohnt
cohnt / box_small.urdf
Last active March 26, 2024 01:20
PointOnBoxSurfaceHelper Failure Reproduction
<?xml version="1.0"?>
<robot name="box_scene">
<material name="Blue">
<color rgba="0.0 0.0 0.8 1.0"/>
</material>
<material name="Red">
<color rgba="0.8 0.0 0.0 1.0"/>
</material>
<material name="Green">
@cohnt
cohnt / regions.pickle
Last active February 2, 2024 21:50
GcsTrajectoryOptimization Bug
@cohnt
cohnt / regions.pickle
Last active January 31, 2024 21:49
GcsTrajectoryOptimization::GetGraphvizString Crash
@cohnt
cohnt / bad_hpolyhedron.py
Last active January 29, 2024 19:50
HPolyhedron where MaximumVolumeInscribedEllipsoid Fails
import numpy as np
from pydrake.all import HPolyhedron
A=np.array([[ 1.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00 ],\
[ 0.000000000000000000e+00, 0.000000000000000000e+00, -1.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00 ],\
[ 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, -1.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00 ],\
[ 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, -1.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00 ],\
[ 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e+00, 0.000000000000000000e