Based on the API documentation load_trajectory
loads specified trajectory from the controller box. Is it instead possible to load it from a local file system? For example, I am recording trajectories via xArm Studio, then I’d download the .traj
file and add it to my python project. Finally, I would load&play the .traj
using Python SDK.
Dear Arturs,
Actually, when you record trajectories via xArmStudio, the .traj file will be saved in the control box automatically.
You just need to call load_trajectory(‘filename’) in your python program, no need to load it in the local file system.
For your reference:xArm-Python-SDK/3003-playback_trajectory.py at master · xArm-Developer/xArm-Python-SDK · GitHub
Best regards,
Thanks, Minna, I understand that. However, I would like to keep all my project-related files in one place (also version controlled via Github). It is also easier for me to organize them in folders if they .traj are locally held.
For example, imagine if multiple people work on a project and create .traj files via separate arms. Currently, the way to sync .traj files (from 2 people) is for person A to download .traj files from the controller, send them to me, and I need to replace the old .traj files on the box with the new ones. However, if they were held locally, we could simply use Github to pull the changes and our Python SDK would pick it up automatically.
Dear Arturs,
Sorry, it can not load from the local file system as the trajectories recording and playback function is controlled by the firmware, the firmware can not find the local file path, thanks for your understanding.
Best regards,
Minna
Is it something that could be added in the next release? Trajectory files simply contain a list of motor positions, python SDK already has functionality to move to a single position. So it shouldnt be difficult to expand to accept multiple positions in series.
Dear Arturs,
You can implement it by yourself, read the position in the local trajectory file, send it to the robot via set_servo_angle(is_radian=True). Or do you also want to load the file into xArmStudio and show it in the recording project?
Best regards,
No, no need to be shown in xArmStudio.
I haven’t tried implementing it myself. I was just wondering whether I would be able to hit 250 Hz frequency if I send one by one. But I guess I should try it out and see if it works.
Dear Arturs,
Please try and let us know the result.
You can read the first position in the file and send it via set_servo_angle(not the highest speed).
The remaining points are sent using set_servo_angle_j(servoj mode) at a frequency of 250HZ. If you are using Win, there may be a delay.
If you can use Linux, you may refer to the below link to build real-time Linux.
https://docs.ros.org/en/galactic/Tutorials/Building-Realtime-rt_preempt-kernel-for-ROS-2.html
Best regards,
Minna
Hey Minna,
I finally had some time to work on this - and I can confirm that set_servo_angle
is too slow, but with set_servo_angle_j
it works fine. Thanks.
Maybe there could be a function in the future where you could send out a batch of angles set_servo_angle_j
so that there aren’t unnecessary hundreds of requests made.
Arturs, Thanks for the suggestion, We will consider and implement it in the further future.
Best regards,
Minna