Skip to content

Commit

Permalink
Avoid code duplication, thanks @rethink-imcmahon
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoan Mollard committed Jul 28, 2015
1 parent 3f9c0a4 commit 4235b03
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/baxter_pykdl/baxter_pykdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,16 @@ def print_kdl_chain(self):
def joints_to_kdl(self, type, values=None):
kdl_array = PyKDL.JntArray(self._num_jnts)

if type == 'positions':
if values is None:
if values is None:
if type == 'positions':
cur_type_values = self._limb_interface.joint_angles()
else:
cur_type_values = values
elif type == 'velocities':
if values is None:
elif type == 'velocities':
cur_type_values = self._limb_interface.joint_velocities()
else:
cur_type_values = values
elif type == 'torques':
if values is None:
elif type == 'torques':
cur_type_values = self._limb_interface.joint_efforts()
else:
cur_type_values = values
else:
cur_type_values = values

for idx, name in enumerate(self._joint_names):
kdl_array[idx] = cur_type_values[name]
if type == 'velocities':
Expand Down

0 comments on commit 4235b03

Please sign in to comment.