Skip to content

Instantly share code, notes, and snippets.

View justagist's full-sized avatar
⚠️
raise CoffeeNotFoundError

Saif Sidhik justagist

⚠️
raise CoffeeNotFoundError
View GitHub Profile
@justagist
justagist / remove_submodule.sh
Created March 8, 2024 10:40
Cleanly remove submodule
# From https://stackoverflow.com/a/36593218/2066118
# Remove the submodule entry from .git/config
git submodule deinit -f path/to/submodule
# Remove the submodule directory from the superproject's .git/modules directory
rm -rf .git/modules/path/to/submodule
# Remove the entry in .gitmodules and remove the submodule directory located at path/to/submodule
git rm -f path/to/submodule
@justagist
justagist / pybullet_robot.py
Created March 5, 2024 10:41
Pybullet interface for any robot urdfs. Primary purpose is for testing controllers and planners. Not implemented for handling vision/camera/sensor information.
"""This is a standalone file for interfacing with any robot in pybullet.
FEATURES:
- Main use-case is for controlling the robot. Not implemented for testing vision/camera stuff.
- Handles prismatic, revolute and continuous joints.
- Control in torque (Position, velocity, torque targets) or in direct position mode.
- Retrieve kinematic and dynamics data for links and robot.
- Get contact states for specified end-effectors (or links)
TODO:
@justagist
justagist / pink_interface.py
Created January 30, 2024 19:31
Utility interface class for inverse kinematics and dynamics computations using PINK library, for all type of robot embodiments.
"""Provides utility interface class for inverse kinematics and dynamics computations using PINK library.
If the functionalities of this class are required only intermittently and is not super performance-demanding,
the utility functions in ik_utils.py might be enough.
This is a standalone file.
pypi dependencies: [numpy, pin, pin-pink]
"""
from pink import Configuration, solve_ik, custom_configuration_vector
from pink.tasks import FrameTask, PostureTask, Task
@justagist
justagist / pinocchio_interface.py
Last active March 5, 2024 10:45
An interface class for using Kinematics and Dynamics computations offered by Pinocchio library, supporting all types of robots.
"""Provides utilities for kinematics and dynamics parameters retrievals.
This is a standalone file.
pypi dependencies: [numpy, pin]
FEATURES:
- Retrieve all dynamics and kinematics info for any robot (urdf).
- All methods become available after a single call to the `update()` method of the class, which will compute
all required kinematics and dynamics data, which can be retreived using the other methods in the class.
- Handles continuous joints in addition to revolute and prismatic joints.
@justagist
justagist / clear_rosparams.py
Last active December 24, 2021 11:25
Delete ros parameters from server containing strings provided as arguments
#!/usr/bin/env python
import rospy
from argparse import ArgumentParser
COMMON_PARAMS = ["franka", "panda", "controller", "control", "camera", "gazebo", "state", "arm", "robot", "dynamic_reconfigure", "interactive_marker", "sim_time"]
def delete_params_containing(string_list, verbose=False):
"""
Delete ros parameters from server containing strings listed in 'string_list'.
@justagist
justagist / hybrid_force_motion_control.py
Last active July 27, 2021 08:58
sample simplified hybrid force-motion code
# feedback control loop for hybrid force motion control (simplified)
def compute_cmd(self, time_elapsed=None):
robot_state = robot.state() # from FRI
# calculate the jacobian of the end effector
jac_ee = robot_state['jacobian']
# get position of the end-effector
curr_pos = robot_state['ee_point']

Keybase proof

I hereby claim:

  • I am justagist on github.
  • I am justagist (https://keybase.io/justagist) on keybase.
  • I have a public key whose fingerprint is 1663 461F FB34 C742 63E7 9880 7464 276E CBA4 DF8E

To claim this, I am signing this object:

@justagist
justagist / railpro_download.py
Last active February 11, 2021 12:24
Download and create a csv or xlsx file containing all the listed companies from railpro.co.uk
"""
Download all listed companies from raipro.co.uk.
Saves to a single csv/xlsx file with columns
"Company Name", "Address", "Phone", "Website"
"""
import re
import urllib.request
import pandas as pd
import html
@justagist
justagist / base_to_cam_transform.py
Created October 2, 2020 10:05
Utility to compute the transformation matrix between two frames given 4 corresponding points from the two frames. Can be used to get the T matrix defined from the robot base to the camera frame (or vice versa).
import numpy as np
def get_transformation(points1, points2):
"""
Get the transformation matrix that would define
frame 2 wrt frame 1, given 4 points from coordinate
frame 1 and corresponding 4 points from coordinate
frame 2. Can be used to find the camera frame wrt
robot base frame when the end-effector positions are
collected from the robot as well as the camera
@justagist
justagist / todo_pub.md
Last active June 3, 2021 12:44
Planned updates to public packages
  • Change all sudo pip to pip --user
  • Python 2 + 3 compatibility. Current issue: shebangs for node scripts.
  • Disable switching to default controller if current controller is position controller. (maybe?)
  • GrippperInterface->close() method bug: if gripper is already closed, the method causes the gripper to open instead.
  • Rename set_joint_positions_velocities to set_joint_positions_impedance_ctrl or something more meaningful. Leave old method for backward compatibility.
backburner