Skip to content

Instantly share code, notes, and snippets.

Avatar

erwincoumans

View GitHub Profile
@erwincoumans
erwincoumans / BasicDemo.cpp
Created Oct 21, 2020
Kinematic btRigidBody example
View BasicDemo.cpp
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2015 Google Inc. http://bulletphysics.org
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
@erwincoumans
erwincoumans / read_scales.py
Created Mar 29, 2019
DYMO usb scale reading (multiple scales)
View read_scales.py
import sys
import usb.core
VENDOR_ID = 0x0922
PRODUCT_ID = 0x8003
# find USB devices
devices = list(usb.core.find(find_all=True, idVendor=VENDOR_ID,
idProduct=PRODUCT_ID))
View pybullet_physx
import pybullet as p
import time
usePhysX = True
if usePhysX:
p.connect(p.PhysX)
p.loadPlugin("eglRendererPlugin")
else:
p.connect(p.GUI)
@erwincoumans
erwincoumans / minitaur_gym_env.py
Created Oct 29, 2017
minitaur gym environment with bunny on its back
View minitaur_gym_env.py
"""This file implements the gym environment of minitaur.
"""
import os, inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(os.path.dirname(currentdir))
os.sys.path.insert(0,parentdir)
@erwincoumans
erwincoumans / ground.urdf
Created Oct 28, 2017
pybullet URDF example of a static concave triangle mesh (non-moving)
View ground.urdf
<?xml version="1.0" ?>
<robot name="ground">
<link name="ground">
<visual>
<geometry>
<mesh filename="ground.obj" scale="2 2 0.1" />
</geometry>
<material name="white">
<color rgba="1 1 1 1"/>
</material>
@erwincoumans
erwincoumans / test.py
Created Oct 28, 2017
pybullet concave collision test
View test.py
import pybullet as p
import time
p.connect(p.GUI)
#disable rendering during loading speeds it up
p.configureDebugVisualizer(p.COV_ENABLE_RENDERING,0)
p.configureDebugVisualizer(p.COV_ENABLE_TINY_RENDERER,0)
p.loadURDF("ground.urdf",useMaximalCoordinates=True)
for i in range (10):
for j in range (10):
@erwincoumans
erwincoumans / dobot.ino
Created Mar 17, 2016
Dobot control using RAMPS 1.4 shield with Arduino Mega
View dobot.ino
//This is taken from https://www.reddit.com/r/Dobot/comments/45ilan/controlling_dobot_with_ramps_14
#include <AccelStepper.h>
#define X_STEP_PIN 54
#define X_DIR_PIN 55
#define X_ENABLE_PIN 38
#define X_MIN_PIN 3
#define X_MAX_PIN 2
@erwincoumans
erwincoumans / gist:6666160
Last active Sep 19, 2021
Example how to create the A matrix and b vector and solve the LCP using Projected Gauss Seidel for Bullet 2.x. Requires Eigen lib and Bullet 2.82. Note that one of the differences between plain projected Gauss Seidel and the Bullet iterative solver is that the friction limits are computed at each iterations, from the related normal force. (This …
View gist:6666160
//#include "Eigen/Dense"
#include "Eigen/Sparse"
static Eigen::VectorXf Solve_GaussSeidel (Eigen::MatrixXf & A, Eigen::VectorXf & b, Eigen::VectorXf & lo,Eigen::VectorXf & hi,int kMax = 5)
{
//A is a m-n matrix, m rows, n columns
if (A.rows() != b.rows())
return b;
int i, j, n = A.rows();