@@ -434,7 +434,7 @@ def get_group_configuration(self, group, full_configuration):
434434 :class:`compas_fab.robots.Configuration`
435435 The configuration of the group.
436436 """
437- full_configuration = self ._check_full_configuration (full_configuration ) # adds joint_names to full_configuration and makes copy
437+ full_configuration , full_configuration_scaled = self ._check_full_configuration_and_scale (full_configuration ) # adds joint_names to full_configuration and makes copy
438438 full_joint_state = dict (zip (full_configuration .joint_names , full_configuration .values ))
439439 group_joint_names = self .get_configurable_joint_names (group )
440440 values = [full_joint_state [name ] for name in group_joint_names ]
@@ -460,7 +460,7 @@ def merge_group_with_full_configuration(self, group_configuration, full_configur
460460 if not len (group_configuration .joint_names ):
461461 group_configuration .joint_names = self .get_configurable_joint_names (group )
462462
463- full_configuration = self ._check_full_configuration (full_configuration ) # adds joint_names to full_configuration and makes copy
463+ full_configuration , full_configuration_scaled = self ._check_full_configuration_and_scale (full_configuration ) # adds joint_names to full_configuration and makes copy
464464
465465 full_joint_state = dict (zip (full_configuration .joint_names , full_configuration .values ))
466466 group_joint_state = dict (zip (group_configuration .joint_names , group_configuration .values ))
@@ -481,7 +481,7 @@ def get_position_by_joint_name(self, configuration, joint_name, group=None):
481481 "Please pass a configuration with %d values or specify group" % len (names ))
482482 return configuration .values [names .index (joint_name )]
483483
484- def _check_full_configuration (self , full_configuration = None ):
484+ def _check_full_configuration_and_scale (self , full_configuration = None ):
485485 """Either creates a full configuration or checks if the passed full configuration is valid.
486486
487487 Parameters
@@ -491,20 +491,20 @@ def _check_full_configuration(self, full_configuration=None):
491491
492492 Returns
493493 -------
494- :class:`compas_fab.robots.Configuration`
495- The full configuration
494+ ( :class:`compas_fab.robots.Configuration`, :class:`compas_fab.robots.Configuration`)
495+ The full configuration and the scaled full configuration
496496 """
497497 joint_names = self .get_configurable_joint_names () # full configuration
498498 if not full_configuration :
499- return self .zero_configuration () # with joint_names
499+ configuration = self .zero_configuration () # with joint_names
500500 else :
501501 # full_configuration might have passive joints specified as well, we allow this.
502502 if len (joint_names ) > len (full_configuration .values ):
503503 raise ValueError ("Please pass a configuration with {} values, for all configurable joints of the robot." .format (len (joint_names )))
504504 configuration = full_configuration .copy ()
505505 if not len (configuration .joint_names ):
506506 configuration .joint_names = joint_names
507- return configuration
507+ return configuration , configuration . scaled ( 1. / self . scale_factor )
508508
509509 # ==========================================================================
510510 # transformations, coordinate frames
@@ -950,8 +950,7 @@ def inverse_kinematics(self, frame_WCF, start_configuration=None,
950950 if not group :
951951 group = self .main_group_name # ensure semantics
952952
953- start_configuration = self ._check_full_configuration (start_configuration )
954- start_configuration_scaled = start_configuration .scaled (1. / self .scale_factor )
953+ start_configuration , start_configuration_scaled = self ._check_full_configuration_and_scale (start_configuration )
955954
956955 frame_WCF_scaled = frame_WCF .copy ()
957956 frame_WCF_scaled .point /= self .scale_factor # must be in meters
@@ -1024,11 +1023,8 @@ def forward_kinematics(self, full_configuration, group=None, backend=None, link_
10241023 if link_name not in self .get_link_names (group ):
10251024 raise ValueError ("Link name %s does not exist in planning group" % link_name )
10261025
1027- zero_configuration = self .zero_configuration ()
1028- if len (full_configuration .values ) != len (zero_configuration .values ):
1029- full_configuration = self .merge_group_with_full_configuration (full_configuration , zero_configuration , group )
1030- full_configuration = self ._check_full_configuration (full_configuration )
1031- full_configuration_scaled = full_configuration .scaled (1. / self .scale_factor )
1026+ full_configuration = self .merge_group_with_full_configuration (full_configuration , self .zero_configuration (), group )
1027+ full_configuration , full_configuration_scaled = self ._check_full_configuration_and_scale (full_configuration )
10321028
10331029 full_joint_state = dict (zip (full_configuration .joint_names , full_configuration .values ))
10341030
@@ -1111,8 +1107,7 @@ def plan_cartesian_motion(self, frames_WCF, start_configuration=None,
11111107
11121108 # NOTE: start_configuration has to be a full robot configuration, such
11131109 # that all configurable joints of the whole robot are defined for planning.
1114- start_configuration = self ._check_full_configuration (start_configuration )
1115- start_configuration_scaled = start_configuration .scaled (1. / self .scale_factor )
1110+ start_configuration , start_configuration_scaled = self ._check_full_configuration_and_scale (start_configuration )
11161111
11171112 max_step_scaled = max_step / self .scale_factor
11181113
@@ -1243,7 +1238,7 @@ def plan_motion(self, goal_constraints, start_configuration=None,
12431238
12441239 # NOTE: start_configuration has to be a full robot configuration, such
12451240 # that all configurable joints of the whole robot are defined for planning.
1246- start_configuration = self ._check_full_configuration (start_configuration )
1241+ start_configuration , start_configuration_scaled = self ._check_full_configuration_and_scale (start_configuration )
12471242
12481243 goal_constraints_WCF_scaled = []
12491244 for c in goal_constraints :
@@ -1277,8 +1272,6 @@ def plan_motion(self, goal_constraints, start_configuration=None,
12771272 else :
12781273 attached_collision_meshes = [self .attached_tool .attached_collision_mesh ]
12791274
1280- start_configuration_scaled = start_configuration .scaled (1. / self .scale_factor )
1281-
12821275 trajectory = self .client .plan_motion (
12831276 robot = self ,
12841277 goal_constraints = goal_constraints_WCF_scaled ,
0 commit comments