Skip to content

Commit

Permalink
Corrected order of fingers moving when using demo icons (#764)
Browse files Browse the repository at this point in the history
* improving finger action order

* Lint fix

* License fix
  • Loading branch information
maxzieba authored Aug 15, 2022
1 parent ccf94ee commit 9cc0709
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 26 deletions.
39 changes: 21 additions & 18 deletions sr_demos/scripts/sr_demos/close.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

# Copyright 2021 Shadow Robot Company Ltd.
# Copyright 2021-2022 Shadow Robot Company Ltd.
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
Expand Down Expand Up @@ -68,20 +68,23 @@ def execute_trajectory(hand_commander, joint_states_no_id, joint_prefix, msg, ti

hand_commander = SrHandCommander(name=hand_name)

open_hand_no_id = {'FFJ1': 0.0, 'FFJ2': 0.0, 'FFJ3': 0.0, 'FFJ4': 0.0,
'MFJ1': 0.0, 'MFJ2': 0.0, 'MFJ3': 0.0, 'MFJ4': 0.0,
'RFJ1': 0.0, 'RFJ2': 0.0, 'RFJ3': 0.0, 'RFJ4': 0.0,
'LFJ1': 0.0, 'LFJ2': 0.0, 'LFJ3': 0.0, 'LFJ4': 0.0, 'LFJ5': 0.0,
'THJ1': 0.0, 'THJ2': 0.0, 'THJ3': 0.0, 'THJ4': 0.0, 'THJ5': 0.0,
'WRJ1': 0.0, 'WRJ2': 0.0}
close_hand_no_id = {'FFJ1': 1.5707, 'FFJ2': 1.5707, 'FFJ3': 1.5707, 'FFJ4': 0.0,
'MFJ1': 1.5707, 'MFJ2': 1.5707, 'MFJ3': 1.5707, 'MFJ4': 0.0,
'RFJ1': 1.5707, 'RFJ2': 1.5707, 'RFJ3': 1.5707, 'RFJ4': 0.0,
'LFJ1': 1.5707, 'LFJ2': 1.5707, 'LFJ3': 1.5707, 'LFJ4': 0.0,
'LFJ5': 0.0,
'WRJ1': 0.0, 'WRJ2': 0.0}
close_thumb_no_id = {'THJ1': 0.52, 'THJ2': 0.61, 'THJ3': 0.0, 'THJ4': 1.20, 'THJ5': 0.17}

execute_trajectory(hand_commander, open_hand_no_id, joint_prefix, "Moving to open position")
execute_trajectory(hand_commander, close_hand_no_id, joint_prefix, "Moving fingers to close position")
execute_trajectory(hand_commander, close_thumb_no_id, joint_prefix, "Moving thumb to close position")
open_thumb = {'THJ1': 0.0, 'THJ2': 0.0, 'THJ3': 0.0, 'THJ4': 0.0, 'THJ5': 0.0}
open_fingers = {'FFJ1': 0.0, 'FFJ2': 0.0, 'FFJ3': 0.0, 'FFJ4': 0.0,
'MFJ1': 0.0, 'MFJ2': 0.0, 'MFJ3': 0.0, 'MFJ4': 0.0,
'RFJ1': 0.0, 'RFJ2': 0.0, 'RFJ3': 0.0, 'RFJ4': 0.0,
'LFJ1': 0.0, 'LFJ2': 0.0, 'LFJ3': 0.0, 'LFJ4': 0.0, 'LFJ5': 0.0,
'THJ1': 0.0, 'THJ2': 0.0, 'THJ3': 0.0, 'THJ4': 0.0, 'THJ5': 0.0,
'WRJ1': 0.0, 'WRJ2': 0.0}
close_fingers = {'FFJ1': 1.5707, 'FFJ2': 1.5707, 'FFJ3': 1.5707, 'FFJ4': 0.0,
'MFJ1': 1.5707, 'MFJ2': 1.5707, 'MFJ3': 1.5707, 'MFJ4': 0.0,
'RFJ1': 1.5707, 'RFJ2': 1.5707, 'RFJ3': 1.5707, 'RFJ4': 0.0,
'LFJ1': 1.5707, 'LFJ2': 1.5707, 'LFJ3': 1.5707, 'LFJ4': 0.0,
'LFJ5': 0.0,
'THJ1': 0.0, 'THJ2': 0.0, 'THJ3': 0.0, 'THJ4': 0.0, 'THJ5': 0.0,
'WRJ1': 0.0, 'WRJ2': 0.0}
close_thumb = {'THJ1': 0.52, 'THJ2': 0.61, 'THJ3': 0.0, 'THJ4': 1.20, 'THJ5': 0.17}

execute_trajectory(hand_commander, open_thumb, joint_prefix, "Moving thumb to open position")
execute_trajectory(hand_commander, open_fingers, joint_prefix, "Moving fingers to open position")
execute_trajectory(hand_commander, close_fingers, joint_prefix, "Moving fingers to close position")
execute_trajectory(hand_commander, close_thumb, joint_prefix, "Moving thumb to close position")
18 changes: 10 additions & 8 deletions sr_demos/scripts/sr_demos/open.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

# Copyright 2021 Shadow Robot Company Ltd.
# Copyright 2021-2022 Shadow Robot Company Ltd.
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
Expand Down Expand Up @@ -68,11 +68,13 @@ def execute_trajectory(hand_commander, joint_states_no_id, joint_prefix, msg, ti

hand_commander = SrHandCommander(name=hand_name)

open_hand_no_id = {'FFJ1': 0.0, 'FFJ2': 0.0, 'FFJ3': 0.0, 'FFJ4': 0.0,
'MFJ1': 0.0, 'MFJ2': 0.0, 'MFJ3': 0.0, 'MFJ4': 0.0,
'RFJ1': 0.0, 'RFJ2': 0.0, 'RFJ3': 0.0, 'RFJ4': 0.0,
'LFJ1': 0.0, 'LFJ2': 0.0, 'LFJ3': 0.0, 'LFJ4': 0.0, 'LFJ5': 0.0,
'THJ1': 0.0, 'THJ2': 0.0, 'THJ3': 0.0, 'THJ4': 0.0, 'THJ5': 0.0,
'WRJ1': 0.0, 'WRJ2': 0.0}
open_thumb = {'THJ1': 0.0, 'THJ2': 0.0, 'THJ3': 0.0, 'THJ4': 0.0, 'THJ5': 0.0}
open_fingers = {'FFJ1': 0.0, 'FFJ2': 0.0, 'FFJ3': 0.0, 'FFJ4': 0.0,
'MFJ1': 0.0, 'MFJ2': 0.0, 'MFJ3': 0.0, 'MFJ4': 0.0,
'RFJ1': 0.0, 'RFJ2': 0.0, 'RFJ3': 0.0, 'RFJ4': 0.0,
'LFJ1': 0.0, 'LFJ2': 0.0, 'LFJ3': 0.0, 'LFJ4': 0.0, 'LFJ5': 0.0,
'THJ1': 0.0, 'THJ2': 0.0, 'THJ3': 0.0, 'THJ4': 0.0, 'THJ5': 0.0,
'WRJ1': 0.0, 'WRJ2': 0.0}

execute_trajectory(hand_commander, open_hand_no_id, joint_prefix, "Moving to open position")
execute_trajectory(hand_commander, open_thumb, joint_prefix, "Moving thumb to open position")
execute_trajectory(hand_commander, open_fingers, joint_prefix, "Moving fingers to open position")

0 comments on commit 9cc0709

Please sign in to comment.