Skip to content

Commit

Permalink
B#tqc 75 fixing issue with get tactiles call (#762)
Browse files Browse the repository at this point in the history
* B#tqc 75 fixing demo behaviour to tactile (#758)

* Initial analysis of components that need to be changed

* Remove dependence from --tactiles argument; Add rospy.sleep()

* Necessary change to avoid unnecessary warnings (SrHandCommander also connects to available tactile sensors)

* Clean code and comments

* Add sensor purchase information

* Fix issue for bimanual mode. Preventing any tactile method from running if sensor is not found. Updating license

* Fix issue with get_tactiles() method call. Fix typo.
  • Loading branch information
rnzenha-s authored Jul 20, 2022
1 parent 4316e32 commit 3d56365
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions sr_demos/scripts/sr_demos/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def __init__(self, hand_commander, demo_joint_states, prefix):
self.prefix = prefix

# Read tactile type
self.tactile_reciever = TactileReceiver(prefix)
self.tactile_type = self.tactile_reciever.get_tactile_type()
self.tactile_receiver = TactileReceiver(prefix)
self.tactile_type = self.tactile_receiver.get_tactile_type()

if self.get_tactiles() is None:
rospy.loginfo("You don't have tactile sensors. " +
Expand Down Expand Up @@ -73,7 +73,7 @@ def zero_tactile_sensors(self):
def read_tactile_values(self):
if self.get_tactiles() is not None:
# Read current state of tactile sensors
tactile_state = self.tactile_reciever.get_tactile_state()
tactile_state = self.tactile_receiver.get_tactile_state()

if self.tactile_type == "biotac":
self.tactile_values['FF'] = tactile_state.tactiles[0].pdc
Expand Down Expand Up @@ -561,7 +561,7 @@ def execute_command_check(hand_commander, joint_states_config, joint_states,

if joint_prefix == 'both': # Bimanual mode
# check if tactile sensors have been previously found for at least one hand
if tactile_right.get_tactiles is not None or tactile_left.get_tactiles is not None:
if tactile_right.get_tactiles() is not None or tactile_left.get_tactiles() is not None:
# confirm_touched() will return None if no sensors are found
touched_right = tactile_right.confirm_touched()
touched_left = tactile_left.confirm_touched()
Expand All @@ -573,7 +573,7 @@ def execute_command_check(hand_commander, joint_states_config, joint_states,
elif touched_left is not None:
touched = touched_left
# check if tactile sensors have been previously found
elif tactile_reading.get_tactiles is not None: # Unimanual mode
elif tactile_reading.get_tactiles() is not None: # Unimanual mode
touched = tactile_reading.confirm_touched()

# If the tactile is touched, trigger the corresponding function
Expand Down

0 comments on commit 3d56365

Please sign in to comment.