Skip to content

Instantly share code, notes, and snippets.

@danzimmerman
danzimmerman / quaternions.md
Last active January 25, 2024 18:30
Quaternion Notes

Quaternion Notes and Cheatsheet

Basics

Following [1], which has further useful information.

A quaternion is defined in terms of its scalar part $w$ and vector part $\mathbf{v}$:

$\huge\mathbf{q} = (w,\hspace{0.5em}\mathbf{v}) = (w, x, y, z)$

@danzimmerman
danzimmerman / mambaforge.sh
Last active July 12, 2022 03:31
Mambaforge quiet/isolated like Eric C TRI
#Following https://gist.github.com/EricCousineau-TRI/b713101b2a90d16e230fc250077ec4a2 (which is used to avoid clashing with Drake)
# In terminal: Install
bash ~/Downloads/Mambaforge-<whatever platform>.sh -b -s -p ~/.local/opt/mambaforge
ln -s ~/.local/opt/mambaforge/bin/conda ~/.local/bin
# Add to ~/.bash_aliases:
# Add function to explicitly add in conda shell util, rather than using its injected defaults.
conda-setup() {
eval "$(conda shell.bash hook)"
@danzimmerman
danzimmerman / DaeMeshFileSetObject.py
Created February 20, 2022 05:21
meshcat-python Collada loader texture/color hack
class DaeMeshFileSetObject(object):
def __init__(self, dae_file, meshcat_path_string):
"""
Assumes that all images are in the same directory as the .dae file
"""
self.file = pathlib.Path(dae_file).absolute().resolve()
self.path = meshcat_path_string
# -- we don't really need to hold on to these but for debugging it'll be nice to keep them
self.dae_tree = None
self.file_contents = None
@danzimmerman
danzimmerman / DAEMeshFileSetObject.py
Last active June 7, 2022 02:36
DAE _meshfile_object loader toward meshcat-python colored Collada
import base64
import pathlib
import xml.etree.ElementTree as Et
import uuid
class DaeMeshFileSetObject(object):
def __init__(self, dae_file, meshcat_path_string):
"""
Assumes that all images are in the same directory as the .dae file
"""
@danzimmerman
danzimmerman / ur10_desc.urdf
Created May 8, 2021 16:36
universal_robot/ur_description UR10 URDF taken from parameter server for visual issue debugging
<?xml version="1.0" ?>
<!-- =================================================================================== -->
<!-- | This document was autogenerated by xacro from C:\Code\ros\workspaces\noethp_ws\src\universal_robot\ur_description\urdf\ur.xacro | -->
<!-- | EDITING THIS FILE BY HAND IS NOT RECOMMENDED | -->
<!-- =================================================================================== -->
<robot name="ur">
<!--
Base UR robot series xacro macro.
NOTE: this is NOT a URDF. It cannot directly be loaded by consumers
@danzimmerman
danzimmerman / advance_matplotlib.py
Created February 24, 2021 17:33
Snippet I never remember to advance matplotlib property cycler
# advance matplotlib property cycler on the axis ax 5 lines
N = 5
for n in range(0, N):
ax._get_lines.prop_cycler.__next__()
@danzimmerman
danzimmerman / c_cpp_properties.json
Created January 19, 2021 15:22
ROS C++ Intellisense for VS Code
{
"configurations": [
{
"browse": {
"databaseFilename": "",
"limitSymbolsToIncludedHeaders": true
},
"includePath": [
"C:\\Code\\ros\\workspaces\\npe_ws\\devel\\include\\**",
"C:\\opt\\ros\\melodic\\x64\\include\\**",

I'm using the BOOST_DLL_ALIAS / boost_import_alias() machinery following this recipe to load a DLL library I developed in C++. It's been working great for me.

The library functionality is all in a single class Foo. There's a factory method Foo::Create() that returns a boost::shared_ptr to a new Foo, and a single BOOST_DLL_ALIAS in the project that exports Foo::Create() to a DLL symbol CreateFoo. The project is compiled to FooLibrary.dll and can be loaded and used from C++ exactly as described in the docs.

I want to be able to access the functionality from Python as well, so I defined a pybind11 interface using the PYBIND11_MODULE macro. The module's __init__ is bound to Foo::Create() though I've also tried it bound to a different factory function with the same results. When I compile with the pybind interface, I can

@danzimmerman
danzimmerman / .inputrc
Last active August 8, 2020 20:33
Linux arrow-key history-search thing I always want
# Key bindings, up/down arrow searches through history
# From https://unix.stackexchange.com/questions/5366/command-line-completion-from-command-history
"\e[A": history-search-backward
"\e[B": history-search-forward
"\eOA": history-search-backward
"\eOB": history-search-forward
@danzimmerman
danzimmerman / From_Source_Simplified.md
Last active August 8, 2020 17:37
Notes about installing PyNEC in an Anaconda Virtual Environment

DOES NOT WORK!!! Windows 10 Instructions - PyNEC From Source in Anaconda 3 virtual environment with WSL2 + Ubuntu + VS2019

First of all, you need to follow the original installation instructions for PyNEC with respect to things you need to install on your computer.

This includes installing swig and C/C++ compilers. I have Visual Studio 2019 Community Edition installed, which gives me the MSVC compiler tools. I installed swig 4.0.2 and added it to my PATH.

When I tried the rest of the instructions, I couldn't get build.sh to work. Presumably I need to install make for Windows to get this to work? I think I also had trouble with the softlink. Will try again later with git bash trying to apply some of the things I learned here. However, I got it installed using the instructions below.

These modified instructions use Windows Subsystem for Linux for the make and configure steps, and