add example movement
This commit is contained in:
@@ -136,6 +136,9 @@ class ArmGraspController:
|
||||
def close_fingers(self):
|
||||
self.grab_movement(-0.8)
|
||||
|
||||
def keep_hand_orient(self):
|
||||
self.grab_movement(0.0)
|
||||
|
||||
def move_fingers(self):
|
||||
if self.open:
|
||||
self.open_fingers()
|
||||
@@ -189,11 +192,53 @@ start_location = (1.6766993999481201, 0.3146645724773407, -1.3483989238739014)
|
||||
controller = ArmGraspController("Armature", "WristController", "ShoulderController")
|
||||
new_pos = [1.7, 2.5, -1.3483989238739014]
|
||||
|
||||
x_rand = RandomBounds(0, 2)
|
||||
y_rand = RandomBounds(1, 5)
|
||||
z_rand = RandomBounds(-3, 2)
|
||||
# x_rand = RandomBounds(0, 2)
|
||||
# y_rand = RandomBounds(1, 5)
|
||||
# z_rand = RandomBounds(-3, 2)
|
||||
|
||||
for i in range(10):
|
||||
# for i in range(10):
|
||||
# bpy.context.scene.frame_set(frame_number)
|
||||
# controller.move_arm_rel([x_rand.random(), y_rand.random(), z_rand.random()])
|
||||
# frame_number += 20
|
||||
|
||||
# Start in first position
|
||||
bpy.context.scene.frame_set(frame_number)
|
||||
controller.move_arm_rel([x_rand.random(), y_rand.random(), z_rand.random()])
|
||||
controller.move_arm(start_location)
|
||||
controller.move_shoulder(controller.start_pos_shoulder)
|
||||
controller.keep_hand_orient()
|
||||
|
||||
frame_number += 40
|
||||
bpy.context.scene.frame_set(frame_number)
|
||||
controller.move_arm_rel([start_location[0], 3, start_location[2]])
|
||||
|
||||
# Move back a few frames, make sure hand is open, then close hand
|
||||
frame_number -= 10
|
||||
bpy.context.scene.frame_set(frame_number)
|
||||
controller.keep_hand_orient()
|
||||
frame_number += 20
|
||||
bpy.context.scene.frame_set(frame_number)
|
||||
controller.close_fingers()
|
||||
# Fingers will now close while moving back
|
||||
|
||||
frame_number += 30
|
||||
bpy.context.scene.frame_set(frame_number)
|
||||
controller.move_arm_rel([start_location[0], 1, start_location[2]])
|
||||
|
||||
frame_number -= 10
|
||||
bpy.context.scene.frame_set(frame_number)
|
||||
controller.keep_hand_orient()
|
||||
frame_number += 20
|
||||
bpy.context.scene.frame_set(frame_number)
|
||||
controller.open_fingers()
|
||||
|
||||
frame_number += 30
|
||||
bpy.context.scene.frame_set(frame_number)
|
||||
controller.move_arm([2.5, 0.5, -1.3])
|
||||
|
||||
frame_number += 40
|
||||
bpy.context.scene.frame_set(frame_number)
|
||||
controller.move_arm([3, 2, -1.3])
|
||||
|
||||
frame_number += 40
|
||||
bpy.context.scene.frame_set(frame_number)
|
||||
controller.move_arm([0, 2, -1.3])
|
||||
|
||||
Reference in New Issue
Block a user