Skip to content

Instantly share code, notes, and snippets.

View RicoJia's full-sized avatar
🎯

RicoJia

🎯
View GitHub Profile
PINK = (179, 102, 255)
def draw_point(frame, coords):
cv2.circle(frame, coords, radius=2, color=PINK, thickness=-1)
def draw_box(frame, corners):
cv2.rectangle(frame, corners[0], corners[1], PINK, 3)
corner_points = []
def mouse_drawing(event, x_temp, y_temp, flags, params):
if event == cv2.EVENT_LBUTTONDOWN:
global corner_points
corner_points.append((x_temp, y_temp))
cv2.setMouseCallback("face_tracker", mouse_drawing)
@RicoJia
RicoJia / py
Created August 22, 2021 02:03
ROI Initialization
corner_points = []
SET_ROI = False
def mouse_drawing(event, x_temp, y_temp, flags, params):
if event == cv2.EVENT_LBUTTONDOWN:
global corner_points
corner_points.append((x_temp, y_temp))
cv2.setMouseCallback("face_tracker", mouse_drawing)
@RicoJia
RicoJia / .py
Created December 11, 2020 22:46
import pybullet as p
def apply_external_force(self, force, link_index, position=[0,0,0]):
"""
Apply the specified external force on the specified position on the body / link.
Args:
link_index (int): unique link id. If -1, it will be the base.
force (np.array[float[3]]): external force to be applied.
position (np.array[float[3]], None): position on the link where the force is applied. See `flags` for
import pybullet as p
#This is essential, as this disables the default motor imposed by bullet. These default motors prevent overspeeding, and functions as
#friction drives.
p.setJointMotorControl2(self.model_unique_id, self.secondary_joint_id,
controlMode=p.VELOCITY_CONTROL, force=0)
spring_angle = self.get_joint_angle()
torque = spring_angle * self.torque_k
#apply external force