from argparse import ArgumentParser from time import sleep from frankx import Affine, Robot if __name__ == '__main__': parser = ArgumentParser() parser.add_argument('--host', default='172.16.0.2', help='FCI IP of the robot') args = parser.parse_args() robot = Robot(args.host) robot.set_default_behavior() while True: print('Pose: ', robot.current_pose()) print('Elbow: ', robot.read_once().elbow) sleep(0.05)
import time import numpy as np from frankx import Affine, Robot if __name__ == '__main__': robot = Robot("172.16.0.2") robot.set_default_behavior() while True: print(robot.current_pose()) print(robot.read_once().elbow) time.sleep(0.05)
from argparse import ArgumentParser from frankx import Affine, JointMotion, LinearRelativeMotion, Measure, MotionData, Reaction, Robot, StopMotion if __name__ == '__main__': parser = ArgumentParser() parser.add_argument('--host', default='172.16.0.2', help='FCI IP of the robot') args = parser.parse_args() # Connect to the robot robot = Robot(args.host, repeat_on_error=False) robot.set_default_behavior() robot.recover_from_errors() # Reduce the acceleration and velocity dynamic robot.set_dynamic_rel(0.2) joint_motion = JointMotion([-1.811944, 1.179108, 1.757100, -2.14162, -1.143369, 1.633046, -0.432171]) robot.move(joint_motion) # Define and move forwards motion_down = LinearRelativeMotion(Affine(0.0, 0.0, -0.12), -0.2) motion_down_data = MotionData().with_reaction(Reaction(Measure.ForceZ < -5.0, StopMotion(Affine(0.0, 0.0, 0.002), 0.0))) # You can try to block the robot now. robot.move(motion_down, motion_down_data) if motion_down_data.did_break: print('Robot stopped at: ', robot.current_pose())
import numpy as np from frankx import Affine, LinearMotion, Robot # Connect to the robot robot = Robot("172.16.0.2") robot.recover_from_errors() robot.set_dynamic_rel(0.1) # Define and move forwards camera = Affine(-0.0005, 0.079, 0.011, 0.0, 0.0, 0.0) gripper = Affine(0, 0, -0.18, 0.0, 0.0, 0.0) home = Affine(0.480, -0.025, 0.21, 0.0) robot.move(camera, LinearMotion(home, 1.6)) print(robot.current_pose(camera))