This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |