@@ -341,6 +341,24 @@ def handleWorldGazeDirConstraint(self, c, fields):
341341 wc = pydrakeik .WorldGazeDirConstraint (self .rigidBodyTree , bodyId , bodyAxis , worldAxis , coneThreshold , tspan )
342342 return wc
343343
344+ def handleWorldGazeOrientConstraint (self , c , fields ):
345+
346+ bodyId = self .bodyNameToId [c .linkName ]
347+ tspan = np .asarray (c .tspan , dtype = float )
348+ axis = np .asarray (c .axis , dtype = float )
349+ coneThreshold = c .coneThreshold
350+ threshold = c .threshold
351+
352+ if isinstance (c .quaternion , vtk .vtkTransform ):
353+ quat = transformUtils .getNumpyFromTransform (c .quaternion )
354+ else :
355+ quat = np .asarray (c .quaternion , dtype = float )
356+ if quat .shape == (4 ,4 ):
357+ quat = transformUtils .transformations .quaternion_from_matrix (quat )
358+
359+ wc = pydrakeik .WorldGazeOrientConstraint (self .rigidBodyTree , bodyId , axis , quat , coneThreshold , threshold , tspan )
360+ return wc
361+
344362 def handlePostureConstraint (self , c , fields ):
345363
346364 tspan = np .asarray (c .tspan , dtype = float )
@@ -391,6 +409,7 @@ def makeConstraints(self, fields):
391409 ikconstraints .FixedLinkFromRobotPoseConstraint : self .handleFixedLinkFromRobotPoseConstraint ,
392410 ikconstraints .QuatConstraint : self .handleQuatConstraint ,
393411 ikconstraints .WorldGazeDirConstraint : self .handleWorldGazeDirConstraint ,
412+ ikconstraints .WorldGazeOrientConstraint : self .handleWorldGazeOrientConstraint ,
394413 ikconstraints .PostureConstraint : self .handlePostureConstraint ,
395414 ikconstraints .QuasiStaticConstraint : self .handleQuasiStaticConstraint ,
396415 }
0 commit comments