Merge lp:~shadowrobot/sr-visualization/Bug_grasp_controller_crash_fuerte into lp:sr-visualization/fuerte

Proposed by Toni Oliver
Status: Merged
Merged at revision: 50
Proposed branch: lp:~shadowrobot/sr-visualization/Bug_grasp_controller_crash_fuerte
Merge into: lp:sr-visualization/fuerte
Diff against target: 55 lines (+26/-0)
2 files modified
.bzrignore (+6/-0)
sr_gui_grasp_controller/src/sr_gui_grasp_controller/grasp_controller.py (+20/-0)
To merge this branch: bzr merge lp:~shadowrobot/sr-visualization/Bug_grasp_controller_crash_fuerte
Reviewer Review Type Date Requested Status
Ugo Pending
Review via email: mp+132737@code.launchpad.net

Description of the change

Fixed grasp_controller crash when starting the plugin without running controllers.

https://app.asana.com/0/1470949453683/1682425321707

To post a comment you must log in.
Revision history for this message
markpitchless (markpitchless) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2012-03-23 17:46:16 +0000
3+++ .bzrignore 2012-11-02 19:17:25 +0000
4@@ -20,3 +20,9 @@
5 sr_gui_controller_tuner/.cproject
6 sr_gui_controller_tuner/.project
7 sr_gui_controller_tuner/.pydevproject
8+sr_gui_grasp_controller/.cproject
9+sr_gui_grasp_controller/.project
10+sr_gui_grasp_controller/.pydevproject
11+sr_gui_joint_slider/.cproject
12+sr_gui_joint_slider/.project
13+sr_gui_joint_slider/.pydevproject
14
15=== modified file 'sr_gui_grasp_controller/src/sr_gui_grasp_controller/grasp_controller.py'
16--- sr_gui_grasp_controller/src/sr_gui_grasp_controller/grasp_controller.py 2012-08-09 12:39:54 +0000
17+++ sr_gui_grasp_controller/src/sr_gui_grasp_controller/grasp_controller.py 2012-11-02 19:17:25 +0000
18@@ -379,6 +379,17 @@
19
20 def set_reference_grasp(self):
21 self.current_grasp.joints_and_positions = self.sr_lib.read_all_current_positions()
22+
23+ if self.current_grasp.joints_and_positions is None:
24+ #We try to activate ethercat hand again (detect if any controllers are running, and listen to them to extract the current position)
25+ self.sr_lib.activate_etherCAT_hand()
26+ #Some time to start receiving data
27+ rospy.sleep(0.5)
28+ self.current_grasp.joints_and_positions = self.sr_lib.read_all_current_positions()
29+
30+ if self.current_grasp.joints_and_positions is None:
31+ QMessageBox.warning(self._widget, "Warning", "Could not read current grasp.\nCheck that the hand controllers are running.\nThen click \"Set Reference\"")
32+ return
33
34 self.grasp_interpoler_1 = GraspInterpoler(self.grasp_from_chooser.grasp, self.current_grasp)
35 self.grasp_interpoler_2 = GraspInterpoler(self.current_grasp, self.grasp_to_chooser.grasp)
36@@ -387,10 +398,19 @@
37
38 def grasp_changed(self):
39 self.current_grasp.joints_and_positions = self.sr_lib.read_all_current_positions()
40+
41+ if self.current_grasp.joints_and_positions is None:
42+ QMessageBox.warning(self._widget, "Warning", "Could not read current grasp.\nCheck that the hand controllers are running.\nThen click \"Set Reference\"")
43+ return
44+
45 self.grasp_interpoler_1 = GraspInterpoler(self.grasp_from_chooser.grasp, self.current_grasp)
46 self.grasp_interpoler_2 = GraspInterpoler(self.current_grasp, self.grasp_to_chooser.grasp)
47
48 def interpolate_grasps(self, value):
49+ if self.grasp_interpoler_1 is None \
50+ or self.grasp_interpoler_2 is None:
51+ QMessageBox.warning(self._widget, "Warning", "Could not read current grasp.\nCheck that the hand controllers are running.\nThen click \"Set Reference\"")
52+ return
53 #from -> current
54 if value < 0:
55 targets_to_send = self.grasp_interpoler_1.interpolate(100 + value)

Subscribers

People subscribed via source and target branches

to all changes: