Trajectories
This file presents the different Trajectories - Command functions available with the Trajectories API
Trajectories - Command functions
This section reference all existing functions to control your robot, which include
Playing smoothed waypointed trajectories
Managing saved trajectories
All functions to control the robot are accessible via an instance of the class NiryoRobot
robot = NiryoRobot(<robot_ip_address>)
trajectories = robot.trajectories.get_saved_trajectory_list()
if len(trajectories) > 0:
robot.trajectories.execute_trajectory_saved(trajectories[0])
...
See examples on Examples Section
List of functions subsections:
Trajectories functions
- class Trajectories(client, action_timeout=3600)[source]
- get_saved_trajectory(trajectory_name)[source]
Get saved trajectory from robot intern storage Will raise error if position does not exist
Example:
trajectories.get_saved_trajectory("trajectory_01")
- execute_registered_trajectory(trajectory_name, callback=None)[source]
Execute trajectory from Ned’s memory If a callback function is not passed in parameter, the function will be blocking. Otherwise, the callback will be called when the execution of the function is finished.
Examples:
trajectories.execute_trajectory_saved("trajectory_01") from threading import Event trajectory_event = Event() trajectory_event.clear() def trajectory_callback(result): print(result) trajectory_event.set() trajectories.execute_trajectory_saved("trajectory_01", callback=trajectory_callback) trajectory_event.wait()
- Parameters
callback (function) – Callback invoked on successful execution.
- Return type
- execute_trajectory_from_poses(list_poses, dist_smoothing=0.0, callback=None)[source]
Execute trajectory from list of poses If a callback function is not passed in parameter, the function will be blocking. Otherwise, the callback will be called when the execution of the function is finished.
Examples:
trajectory = [[0.3, 0.1, 0.3, 0., 0., 0., 1.], [0.3, -0.1, 0.3, 0., 0., 0., 1.], [0.3, -0.1, 0.4, 0., 0., 0., 1.], [0.3, 0.1, 0.4, 0., 0., 0., 1.]] trajectories.execute_trajectory_from_poses(trajectory) trajectories.execute_trajectory_from_poses(trajectory, dist_smoothing=0.02) trajectories.execute_trajectory_from_poses([[0.3, 0.1, 0.3, 0., 0., 0., 1.], #[x,y,z,qx,qy,qz,qw] PoseObject(0.3, -0.1, 0.3, 0., 0., 0.), [0.3, -0.1, 0.4, 0., 0., 0.], #[x,y,z,roll,pitch,yaw] PoseObject(0.3, 0.1, 0.4, 0., 0., 0.)]) from threading import Event trajectory_event = Event() trajectory_event.clear() def trajectory_callback(result): print(result) trajectory_event.set() trajectories.execute_trajectory_from_poses(trajectory, callback=trajectory_callback) trajectory_event.wait()
- Parameters
- Return type
- save_trajectory(trajectory, trajectory_name, description)[source]
Save trajectory in robot’s memory
Examples:
trajectory = [[0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [1.57, 0.0, 0.0, 0.0, -1.57, 0.0], [-1.57, 0.0, 0.0, 0.0, -1.57, 0.0]] trajectories.save_trajectory(trajectory, "trajectory_1", "test description trajectory_1")
- save_last_learned_trajectory(trajectory_name, description)[source]
Save last executed trajectory in robot’s memory
Examples:
trajectories.save_last_learned_trajectory("trajectory_1", "test description trajectory_1")
- delete_trajectory(trajectory_name)[source]
Delete trajectory from robot’s memory
Example:
if "trajectory_1" in trajectories.get_saved_trajectory_list(): trajectories.delete_trajectory("trajectory_1")
- Return type
- clean_trajectory_memory()[source]
Delete all trajectories from robot’s memory
Example:
trajectories.clean_trajectory_memory()
- Return type
- get_saved_trajectory_list()[source]
Get list of trajectories’ name saved in robot memory
Example:
if "trajectory_1" in trajectories.get_saved_trajectory_list(): trajectories.delete_trajectory("trajectory_1")