Skip to content

Instantly share code, notes, and snippets.

View EricCousineau-TRI's full-sized avatar

Eric Cousineau EricCousineau-TRI

View GitHub Profile
@EricCousineau-TRI
EricCousineau-TRI / python_multiprocessing_thread_constraints.py
Created January 23, 2019 01:14
python multiprocessing thread constraints
# https://stackoverflow.com/questions/17053671/python-how-do-you-stop-numpy-from-multithreading
# Necessary for multiprocess :(
import os
os.environ.update(
OMP_NUM_THREADS = '1',
OPENBLAS_NUM_THREADS = '1',
NUMEXPR_NUM_THREADS = '1',
MKL_NUM_THREADS = '1',
)
#!/bin/bash
set -eux -o pipefail
# Example usage (parallel processing w/ 10 jobs):
# find -name '*.pth' | xargs -P 10 -n 1 ./py2_to_py3.sh
py2=~/venv/py2
py3=~/venv/py3
if [[ ! -f ${py2}/bin/python ]]; then
@EricCousineau-TRI
EricCousineau-TRI / multibody_extras.cc
Created March 7, 2019 22:43
Drake Issue 10859: Multibody Extras
// From Anzu
std::vector<const Body<double>*> GetRigidBodies(
const MultibodyPlant<double>& plant,
std::vector<ModelInstanceIndex> models) {
std::vector<const Body<double>*> bodies;
for (const auto model : models) {
for (const auto body_index : plant.GetBodyIndices(model)) {
const auto* body = &plant.get_body(body_index);
DRAKE_DEMAND(body != &plant.world_body());
@EricCousineau-TRI
EricCousineau-TRI / pose_example_stuff.txt
Created March 13, 2019 17:11
SDF Pose Discussion Bits
Current:
xyz="..." rpy="..."
Next:
xyz="{xyz_AB}" rpy="{rpy_AB}"
<pose frame="{A}">{xyz_AB} {rpy_AB}</pose>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
diff --git a/include/rcpputils/visibility_control.hpp b/include/rcpputils/visibility_control.hpp
index 20af527..b03720e 100644
--- a/include/rcpputils/visibility_control.hpp
+++ b/include/rcpputils/visibility_control.hpp
@@ -4,27 +4,30 @@
// Software License Agreement (BSD License 2.0)
//
// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
+// modification, are permitted provided that the following conditions
@EricCousineau-TRI
EricCousineau-TRI / pushing_to_mercurial_repo_using_git.md
Last active June 7, 2019 18:04
Pushing to Mercurial Repo using Git
#!/usr/bin/env python3
"""
With an exiting OBJ and GLTF file, re-generate mesh from OBJ and overwrite
GLTF's, but preserve (some) GLTF properties.
"""
import argparse
from collections import OrderedDict
from os.path import splitext, isfile, dirname, basename
def datetime_from_posix_timedelta(delta):
# Following: https://docs.python.org/3.6/library/datetime.html#datetime.datetime.fromtimestamp
d = datetime(1970, 1, 1, tzinfo=timezone.utc) + delta
return d.astimezone()
def lcm_datetime(timestamp):
return datetime_from_posix_timedelta(timedelta(microseconds=timestamp))
diff --git a/bindings/pydrake/examples/manipulation_station_py.cc b/bindings/pydrake/examples/manipulation_station_py.cc
index b4e61b58b..4f0738f6a 100644
--- a/bindings/pydrake/examples/manipulation_station_py.cc
+++ b/bindings/pydrake/examples/manipulation_station_py.cc
@@ -41,13 +41,13 @@ PYBIND11_MODULE(manipulation_station, m) {
using RenderEngineMap =
std::map<std::string, std::unique_ptr<geometry::render::RenderEngine>>;
py::class_<ManipulationStation<T>, Diagram<T>>(m, "ManipulationStation")
- .def(py::init<double, RenderEngineMap>(), py::arg("time_step"),
- py::arg("render_engines") = RenderEngineMap(),