File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 1
- #! /usr/bin/env python
1
+ #/usr/bin/env python
2
2
3
3
# Copyright (c) 2013, Carnegie Mellon University
4
4
# All rights reserved.
@@ -1167,3 +1167,22 @@ def wrap_to_interval(angles, lower=-numpy.pi):
1167
1167
@type lower float or numpy.array
1168
1168
"""
1169
1169
return (angles - lower ) % (2 * numpy .pi ) + lower
1170
+
1171
+ def GetManipulatorIndex (robot , manip = None ):
1172
+ """
1173
+ Takes a robot and returns the active manipulator and its index
1174
+ @param robot The OpenRAVE robot
1175
+ @param manip The robot manipulator
1176
+ @return (manip, manip_idx) The manipulator and its index
1177
+ """
1178
+
1179
+ with robot .GetEnv ():
1180
+ if manip is None :
1181
+ manip = robot .GetActiveManipulator ()
1182
+
1183
+ with robot .CreateRobotStateSaver (
1184
+ robot .SaveParameters .ActiveManipulator ):
1185
+ robot .SetActiveManipulator (manip )
1186
+ manip_idx = manip .GetRobot ().GetActiveManipulatorIndex ()
1187
+
1188
+ return (manip , manip_idx )
You can’t perform that action at this time.
0 commit comments