@@ -108,7 +108,7 @@ def apriltag_message_callback(apriltag_array):
108
108
global base_in_base_pose
109
109
global cam_in_base_pose
110
110
global marker_pose_apriltag_frame
111
- global obj_orientation_matrix
111
+ global obj_pose_homog
112
112
global object_detected
113
113
114
114
obj_apriltag_list = [
@@ -133,7 +133,7 @@ def apriltag_message_callback(apriltag_array):
133
133
obj_apriltag_in_world_pose ,
134
134
frame_id = "base" )
135
135
136
- obj_orientation_matrix = ros_helper .matrix_from_pose (
136
+ obj_pose_homog = ros_helper .matrix_from_pose (
137
137
marker_apriltag_in_world_pose )
138
138
139
139
else :
@@ -390,7 +390,7 @@ def plot_hand_friction_cone(cv_image,COP_point_hand_frame,friction_parameter_dic
390
390
391
391
x_coord , y_coord = get_pix_easier (
392
392
np .dot (contact_pose_homog , left_boundary_list ),
393
- transformation_matrix )
393
+ camera_transformation_matrix )
394
394
cv2 .polylines (cv_image , [np .vstack ([x_coord , y_coord ]).T ],
395
395
True , (0 , 255 , 0 ),
396
396
thickness = 2 )
@@ -410,7 +410,7 @@ def plot_hand_friction_cone(cv_image,COP_point_hand_frame,friction_parameter_dic
410
410
411
411
x_coord , y_coord = get_pix_easier (
412
412
np .dot (contact_pose_homog , right_boundary_list ),
413
- transformation_matrix )
413
+ camera_transformation_matrix )
414
414
cv2 .polylines (cv_image , [np .vstack ([x_coord , y_coord ]).T ],
415
415
True , (0 , 255 , 0 ),
416
416
thickness = 2 )
@@ -449,12 +449,21 @@ def plot_ground_friction_cone(cv_image,COP_ground,friction_parameter_dict,camera
449
449
])
450
450
451
451
x_coord , y_coord = get_pix_easier (
452
- BoundaryPts , transformation_matrix )
452
+ BoundaryPts , camera_transformation_matrix )
453
453
cv2 .polylines (cv_image ,
454
454
[np .vstack ([x_coord , y_coord ]).T ],
455
455
False , (0 , 255 , 0 ),
456
456
thickness = 2 )
457
457
458
+ def shape_overlay (cv_image ,obj_pose_homog ,object_vertex_array ,camera_transformation_matrix ):
459
+ vertex_positions_world = np .dot (obj_pose_homog ,object_vertex_array )
460
+ x_coord , y_coord = get_pix_easier (
461
+ vertex_positions_world , camera_transformation_matrix )
462
+ cv2 .polylines (cv_image ,
463
+ [np .vstack ([x_coord , y_coord ]).T ],
464
+ True , (0 , 255 , 0 ),
465
+ thickness = 2 )
466
+
458
467
#def plot_force():
459
468
460
469
#def plot_hand_slide_arrow():
@@ -482,7 +491,7 @@ def plot_impedance_target(cv_image,hand_points,target_pose_homog,camera_transfor
482
491
base_in_base_pose = None
483
492
cam_in_base_pose = None
484
493
marker_pose_apriltag_frame = None
485
- obj_orientation_matrix = None
494
+ obj_pose_homog = None
486
495
object_detected = False
487
496
488
497
measured_contact_wrench_list = []
@@ -521,7 +530,7 @@ def plot_impedance_target(cv_image,hand_points,target_pose_homog,camera_transfor
521
530
l_contact = sys_params .object_params ["L_CONTACT_MAX" ]
522
531
523
532
object_vertex_array , apriltag_id , apriltag_pos = load_shape_data (
524
- 'triangle ' )
533
+ 'big_hexagon ' )
525
534
526
535
object_vertex_array = np .vstack ([
527
536
object_vertex_array ,
@@ -818,7 +827,9 @@ def plot_impedance_target(cv_image,hand_points,target_pose_homog,camera_transfor
818
827
x_coord = int (np .round (pix_x [0 ]))
819
828
y_coord = int (np .round (pix_y [0 ]))
820
829
821
- current_dot_positions = np .dot (obj_orientation_matrix ,
830
+ shape_overlay (cv_image ,obj_pose_homog ,object_vertex_array ,transformation_matrix )
831
+
832
+ current_dot_positions = np .dot (obj_pose_homog ,
822
833
object_vertex_array )
823
834
824
835
hand_tangent_world = np .dot (contact_pose_homog , hand_tangent )
@@ -879,7 +890,7 @@ def plot_impedance_target(cv_image,hand_points,target_pose_homog,camera_transfor
879
890
[0. , 0. , 0. , 1. ],
880
891
])
881
892
desired_dot_positions = np .dot (
882
- obj_orientation_matrix ,
893
+ obj_pose_homog ,
883
894
np .dot (my_rotation , temp_vertex_array ))
884
895
885
896
if qp_debug_dict is not None and 'err_x_pivot' in qp_debug_dict [
@@ -930,13 +941,13 @@ def plot_impedance_target(cv_image,hand_points,target_pose_homog,camera_transfor
930
941
Tau_a = np .dot (
931
942
np .cross (P_a [0 :3 ] - P_e [0 :3 ],
932
943
measured_base_wrench_6D [0 :3 ]),
933
- obj_orientation_matrix [0 :3 , 2 ])
944
+ obj_pose_homog [0 :3 , 2 ])
934
945
Tau_b = np .dot (
935
946
np .cross (P_b [0 :3 ] - P_e [0 :3 ],
936
947
measured_base_wrench_6D [0 :3 ]),
937
- obj_orientation_matrix [0 :3 , 2 ])
948
+ obj_pose_homog [0 :3 , 2 ])
938
949
Tau_net = np .dot (measured_base_wrench_6D [3 :6 ],
939
- obj_orientation_matrix [0 :3 , 2 ])
950
+ obj_pose_homog [0 :3 , 2 ])
940
951
941
952
epsilon1 = (Tau_net - Tau_b ) / (Tau_a - Tau_b )
942
953
epsilon1 = np .max ([np .min ([epsilon1 , 1 ]), 0 ])
0 commit comments