8000 Merge branch 'micah-dev' into sam-dev · lordkeks/robotics-toolbox-python@7e1fbf4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7e1fbf4

Browse files
committed
Merge branch 'micah-dev' into sam-dev
2 parents 8428373 + ae61f11 commit 7e1fbf4

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

graphics/graphics_robot.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
from graphics.graphics_canvas import *
22
from graphics.common_functions import *
33

4+
# TODO
5+
# update non-stl obj creation (position wrong, ref wrong)
6+
47

58
class DefaultJoint:
69
"""
@@ -50,8 +53,8 @@ def __init__(self,
5053
self.__length = max(self.__graphic_obj.length, self.__graphic_obj.width, self.__graphic_obj.height)
5154

5255
# Set the other reference frame vectors
53-
self.__graphic_ref = draw_reference_frame_axes(self.__connect_to, self.__x_vector, self.__x_rotation)
5456
self.__update_reference_frame()
57+
self.__graphic_ref = draw_reference_frame_axes(self.__connect_to, self.__x_vector, self.__x_rotation)
5558

5659
def update_position(self, new_pos):
5760
"""
@@ -241,6 +244,12 @@ def __set_graphic(self, given_obj):
241244
up=z_axis_vector)
242245
# Set the boxes new origin
243246
graphic_obj = compound([graphic_obj], origin=vector(0, 0, 0), axis=x_axis_vector)
247+
# Set the boxes x and y vector first before applying the Z axis
248+
# Otherwise rotates to the new vector from the original point (unintentionally rotating around it's z axis)
249+
graphic_obj.axis = vector((self.__connect_to.x - self.__connect_from.x),
250+
(self.__connect_to.y - self.__connect_from.y),
251+
0)
252+
graphic_obj.axis.z = (self.__connect_to.z - self.__connect_from.z)
244253
return graphic_obj
245254
else:
246255
# TODO When texture application available, put it here

graphics/graphics_test_features.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,12 @@ def test_rotational_link():
120120

121121
def test_graphical_robot():
122122
canvas_grid = init_canvas()
123-
x = GraphicalRobot([create_link_0()])
123+
124+
x = GraphicalRobot([
125+
RotationalJoint(vector(0, 0, 0), vector(1, 1, 1))
126+
])
127+
128+
x.set_joint_angle(0, radians(20))
124129

125130

126131
def test_place_joint():

0 commit comments

Comments
 (0)
0