You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm trying to make an animation of a robot arm with vedo but whenever I make a large rotation angle the animation starts but then it stops and the window says "No Responde" and shortly afterwards it continues but the animation is already completed. I don't know if it might be my laptop. Sorry if my code looks terrible, I'm still a beginner
#ModelMain.pyfromvedoimport*importnumpyasnpimporttimeimportosfromsettingsimport*# TODO# Gripper1/2# Bewegung hoch und runter einschränken in Auto Modus# ty lagg fix# Auto KallibrationTurnArray= {turnTable, middle, middle_point, forearm, forearm_point, grip, grip_point, gripper1, gripper2}
MiddelArray= {middle, middle_point, forearm, forearm_point, grip, grip_point, gripper1, gripper2}
ForeArmArray= {forearm, forearm_point, grip, grip_point, gripper1, gripper2}
GripArray= {grip, grip_point, gripper1, gripper2}
Gripper1Array= {gripper1, gripper1_point}
Gripper2Array= {gripper2, gripper2_point}
Manuell=False# Ermitteln des Verzeichnisses des aktuellen Skriptsscript_dir=os.path.dirname(os.path.abspath(__file__))
# Dateinamefile_name='commands.eCode'file_path=os.path.join(script_dir, file_name)
deftransfrom_matrix(array):
# Konvertieren Sie das Set in eine Listemesh_list=list(array)
# Greifen Sie auf das erste Element der Liste zumesh=mesh_list[0]
transform_matrix=mesh.transform.matrixrotation_matrix=transform_matrix[:3, :3]
direction_vectors=rotation_matrix.Treturndirection_vectors[0]
defbuttonfunc(obj, ename):
array_test()
defrotate(array, angle):
rotation_point= []
v=vector(1, 0, 0)
ifarray==TurnArray:
rotation_point=turnTable_point.pos()
v=vector(0, 0, 1)
elifarray==MiddelArray:
matrix=transfrom_matrix(array)
v=vector(matrix)
ifangle>27:
angle=27elifangle<-27:
angle=-27rotation_point=middle_point.pos()
elifarray==ForeArmArray:
rotation_point=forearm_point.pos()
matrix=transfrom_matrix(array)
v=vector(matrix)
elifarray==GripArray:
rotation_point=grip_point.pos()
matrix=transfrom_matrix(array)
v=vector(matrix)
# Überprüfen, ob der Winkel negativ istifangle<0:
rotation_direction=1else:
rotation_direction=-1# Anzahl der Schritte basierend auf dem absoluten Winkelwertsteps=abs(angle) //2foryinrange(steps):
# update_positions(np.radians(angle), rotation_point)foriinarray:
i.rotate(2*rotation_direction, axis=v, point=rotation_point)
plt.render()
ifangle>180:
time.sleep(0.01) # Schnellere Rotation für hohe Winkelelse:
time.sleep(0.05) # Langsamere Rotation für niedrige Winkeldefchose_array(inputs):
angle=0try:
teile=inputs.split(",")
Array=teile[0].strip()
a=teile[1].strip().lower()
# Check if the angle is provided as a boolean valueifa=="true":
angle=27elifa=="false":
angle=-27else:
# Attempt to convert the angle to an integerangle=int(a)
ifArray=="S1":
rotate(TurnArray, angle)
elifArray=="S2":
rotate(ForeArmArray, angle)
elifArray=="S3":
rotate(GripArray, angle)
elifArray=="M1":
rotate(MiddelArray, angle)
else:
passexceptValueErrorase:
# Handle the case where the angle cannot be converted to an integerprint(f"Error: Invalid angle value '{a}'. Expected an integer or 'true'/'false'.")
exceptExceptionase:
print(e)
print(inputs)
passdefarray_test():
ifManuell:
eingabe=input(">")
chose_array(eingabe)
elifnotManuell:
ifos.path.exists(file_path):
withopen(file_path, 'r') asfile:
forlineinfile:
print(f"Processing command: {line.strip()}") # Logging the command being processedchose_array(line)
plt.render() # Ensure rendering after processing each commandtime.sleep(0.1) # Adjust sleep interval if necessaryelse:
print(f"Error {file_path} does not exist!")
else:
print(f"Error can't use {file_or_not}!")
plt=Plotter(axes=11)
bu=plt.add_button(
buttonfunc,
pos=(0.5, 0.15),
states=["Start"],
c=["w"],
bc=["black"],
font="ComicMono",
size=30,
bold=False,
italic=False,
)
l1=Light(light, c="w", intensity=10)
l2=Light(light2, c="w", intensity=5)
# forearm.pos([-370, 220, 405])cubemap_path='assets/wide_street_02_8k.hdr'transform_matrix=turnTable.transform.matrixrotation_matrix=transform_matrix[:3, :3]
direction_vectors=rotation_matrix.Tprint("Richtungsvektor 1:", direction_vectors[0])
print("Richtungsvektor 2:", direction_vectors[1])
file_or_not=input("Manuel Or Auto?(m/a)\n")
iffile_or_not.lower() =="m":
Manuell=Trueelse:
passplt.show(base, turnTable, middle, forearm, grip, gripper1, gripper2, l1, l2, turnTable_point, forearm_point,
middle_point, light, point_400, grip_point,
__doc__, axes=1, viewup="z", title="RobotArm")
Hello, I'm trying to make an animation of a robot arm with vedo but whenever I make a large rotation angle the animation starts but then it stops and the window says "No Responde" and shortly afterwards it continues but the animation is already completed. I don't know if it might be my laptop. Sorry if my code looks terrible, I'm still a beginner
Thats the Robot Arm
The text was updated successfully, but these errors were encountered: