Verified Commit 2e79ded6 authored by Nicolas Torres's avatar Nicolas Torres Committed by Justin Carpentier
Browse files

RobotWrapper reduceModel -> buildReducedRobot

parent 46c948a9
......@@ -175,18 +175,18 @@ class RobotWrapper(object):
def framesForwardKinematics(self, q):
pin.framesForwardKinematics(self.model,, q)
def reduceModel(self,
def buildReducedRobot(self,
Reduced the robot model given a list of joints to lock.
Build a reduced robot model given a list of joints to lock.
\tlist_of_joints_to_lock: list of joint indexes/names to lock.
\treference_configuration: reference configuration to compute the
placement of the lock joints. If not provided, reference_configuration
defaults to the robot's neutral configuration.
defaults to the robot's neutral configuration.
NOTE: This operation is not reversible, the original model is lost.
Returns: a new robot model.
# if joint to lock is a string, try to find its index
......@@ -205,9 +205,9 @@ class RobotWrapper(object):
list_of_geom_models=[self.visual_model, self.collision_model],
self.model, self.visual_model, self.collision_model = model, geom_models[
0], geom_models[1]
return RobotWrapper(model=model, visual_model=geom_models[0],
def getFrameJacobian(self, frame_id, rf_frame=pin.ReferenceFrame.LOCAL):
......@@ -59,16 +59,16 @@ print('joints to lock (only ids):', jointsToLockIDs)
print('reduced model: dim=' + str(len(model_reduced.joints)))
print('-' * 30)
# Option 4: Build a RobotWrapper and reduce the model using the wrapper
# Option 4: Build a reduced model of a robot using RobotWrapper
# reference_configuration is optional: if not provided, neutral configuration used
# you can even mix joint names and joint ids
mixed_jointsToLockIDs = [jointsToLockIDs[0], 'wrist_2_joint', 'wrist_3_joint']
robot = pin.RobotWrapper.BuildFromURDF(urdf_filename, mesh_dir)
reduced_robot = robot.buildReducedRobot(list_of_joints_to_lock=mixed_jointsToLockIDs,
# Check dimensions of the reduced model and joint info
print('mixed joints to lock (names and ids):', mixed_jointsToLockIDs)
print('RobotWrapper reduced model: dim=' + str(len(robot.model.joints)))
print('RobotWrapper reduced model: dim=' + str(len(reduced_robot.model.joints)))
for jn in robot.model.joints:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment