Skip to content

Instantly share code, notes, and snippets.

View DanielTakeshi's full-sized avatar
🎯
Focusing

Daniel Seita DanielTakeshi

🎯
Focusing
View GitHub Profile
@DanielTakeshi
DanielTakeshi / Reporting_Errors.md
Last active January 8, 2024 04:45
Guide to Reporting Software Errors

Guide to Reporting Errors (CSCI 545, Spring 2024)

Note: this guide has been written for CSCI 545, Introduction to Robotics, taught by Daniel Seita in Spring 2024. We have a policy that students must state that they have read this guide before requesting software help. This is designed for the benefit of both the course staff but also for the students.

This is a short guide on how to report code-related errors. If you run into errors, following these guidelines will increase the chances that your issue gets quickly resolved. Otherwise, it might result in a protracted

"""
Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
NVIDIA CORPORATION and its licensors retain all intellectual property
and proprietary rights in and to this software, related documentation
and any modifications thereto. Any use, reproduction, disclosure or
distribution of this software and related documentation without an express
license agreement from NVIDIA CORPORATION is strictly prohibited.
Franka Cube Pick
@DanielTakeshi
DanielTakeshi / UR5_IK.py
Last active January 31, 2024 16:37
Isaac Gym, UR5 Inverse Kinematics to target, CPU vs GPU differences
"""
Runs IK to get the UR5 end-effector to reach a target. Inspect CPU vs GPU mode.
Use a yellow sphere to show the tip of the end-effector, and a blue sphere to
show the target. These spheres are only used for debugging / visualization.
"""
from isaacgym import gymapi
from isaacgym import gymutil
from isaacgym import gymtorch
from isaacgym.torch_utils import (quat_conjugate, quat_mul, quat_apply)
import numpy as np
@DanielTakeshi
DanielTakeshi / hsv_segmenter.py
Created March 21, 2022 17:37 — forked from thomasweng15/hsv_segmenter.py
Segment HSV from an image rostopic using OpenCV sliders
import cv2
import rospy
import argparse
import numpy as np
import matplotlib.pyplot as plt
from cv_bridge import CvBridge
from sensor_msgs.msg import Image
class Segmenter():
def __init__(self, args):
@DanielTakeshi
DanielTakeshi / gist:a4a8c431bd3ab30ed578f3b579083c7a
Last active June 16, 2021 21:56
Making subplots in matplotlib, then getting labels to appear at the bottom
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.style.use('seaborn')
import numpy as np
nrows, ncols = 1, 2
fig, ax = plt.subplots(nrows, ncols, sharey=False, squeeze=True, figsize=(9*ncols, 6*nrows))
x = np.arange(100)
y0 = x + np.random.normal(loc=0.0, scale=10.0, size=100)
@DanielTakeshi
DanielTakeshi / gist:fec9a5cd957eb05b04b6d06a16cc88ae
Last active January 7, 2021 15:54
How to make a GIF from MuJoCo environment observations programmatically.
import gym
import numpy as np
import imageio
# Make the environment and the initial observation `o`.
env_name = 'Walker2d-v3'
env = gym.make(env_name)
obs_dim = env.observation_space.shape
act_dim = env.action_space.shape[0]
act_limit = env.action_space.high[0]
@DanielTakeshi
DanielTakeshi / log_unif_example.py
Last active July 26, 2020 15:28
How to sample from a log-uniform distribution.
"""
How we might sample from a log-uniform distribution
https://stats.stackexchange.com/questions/155552/what-does-log-uniformly-distribution-mean
Only run one of these three cases at a time, otherwise the plots update each
other. Run with these versions:
matplotlib 3.2.1
numpy 1.18.3
"""
@DanielTakeshi
DanielTakeshi / catch_test.py
Last active May 12, 2019 18:13
Exception Testing in Python
"""Some exception testing.
The code in the `try` block will stop as soon as any exception is encountered.
https://realpython.com/python-exceptions/
https://realpython.com/the-most-diabolical-python-antipattern/
"""
a = 5
I am testing different PyTorch transforms on my data, and saving sample
images as they are loaded during training. See examples below.
import torch
import torch.nn as nn
import torch.optim as optim
from torch.optim import lr_scheduler
import torchvision.models as models
from torchvision import datasets, transforms
import copy, cv2, os, sys, pickle, time
import numpy as np
from os.path import join