Skip to content

Commit a7e957d

Browse files
committed
Fix indexing issues
1 parent 70d9601 commit a7e957d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

roboticstoolbox/backends/VPython/canvas.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,9 @@ def add_robot(self, robot):
222222
self.__reload_caption(new_list)
223223

224224
# Set it as selected
225-
self.__ui_controls.get('menu_robots').index = \
226-
len(self.__robots) - 1
225+
if self.__ui_mode == UImode.CANVASCONTROL:
226+
self.__ui_controls.get('menu_robots').index = \
227+
len(self.__robots) - 1
227228

228229
# Place camera based on robots effective radius * 1.25
229230
if robot.robot is not None:
@@ -604,15 +605,15 @@ def __setup_joint_sliders(self):
604605
"""
605606
Display the Teachpanel mode of the UI
606607
"""
608+
self.scene.append_to_caption('\n')
609+
if len(self.__teachpanel) == 0:
610+
self.scene.append_to_caption("No robots available\n")
611+
return
607612

608613
# Update the robots to their current joint angles
609614
for joint_idx, joint in enumerate(self.__teachpanel[self.__selected_robot]):
610615
joint[self.__idx_theta] = self.__robots[self.__selected_robot].angles[joint_idx]
611616

612-
self.scene.append_to_caption('\n')
613-
if len(self.__teachpanel) == 0:
614-
self.scene.append_to_caption("No robots available\n")
615-
return
616617
i = 0
617618
for joint in self.__teachpanel[self.__selected_robot]:
618619
if joint[self.__idx_qlim_min] == joint[self.__idx_qlim_max]:

0 commit comments

Comments
 (0)