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: state = robot.read_once() print('\nPose: ', robot.current_pose()) print('O_TT_E: ', state.O_T_EE) print('Joints: ', state.q) print('Elbow: ', state.elbow) sleep(0.05)
from argparse import ArgumentParser from time import sleep from frankx import Robot if __name__ == '__main__': parser = ArgumentParser( description='Control Franka Emika Panda Desk interface remotely.') parser.add_argument('--host', default='172.16.0.2', help='FCI IP of the robot') parser.add_argument('--user', default='admin', help='user name to login into Franka Desk') parser.add_argument('--password', help='password') args = parser.parse_args() with Robot(args.host, args.user, args.password) as api: # api.lock_brakes() api.unlock_brakes()
from frankx import Affine, LinearRelativeMotion, Robot if __name__ == '__main__': # Connect to the robot robot = Robot("172.16.0.2") robot.set_default_behavior() robot.recover_from_errors() # Reduce the acceleration and velocity dynamic robot.set_dynamic_rel(0.2) # Define and move forwards way = Affine(0.0, 0.2, 0.0) motion_forward = LinearRelativeMotion(way) robot.move(motion_forward) # And move backwards using the inverse motion motion_backward = LinearRelativeMotion(way.inverse()) robot.move(motion_backward)
from argparse import ArgumentParser from frankx import Affine, LinearRelativeMotion, 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() # Connect to the robot robot = Robot(args.host) robot.set_default_behavior() robot.recover_from_errors() # Reduce the acceleration and velocity dynamic robot.set_dynamic_rel(0.15) # Define and move forwards way = Affine(0.0, 0.2, 0.0) motion_forward = LinearRelativeMotion(way) robot.move(motion_forward) # And move backwards using the inverse motion motion_backward = LinearRelativeMotion(way.inverse()) robot.move(motion_backward)
from time import sleep from frankx import Affine, JointMotion, ImpedanceMotion, Robot if __name__ == '__main__': # Connect to the robot robot = Robot('172.16.0.2') 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 impedance_motion = ImpedanceMotion(200.0, 20.0) robot_thread = robot.move_async(impedance_motion) sleep(0.05) initial_target = impedance_motion.target print('initial target: ', initial_target) sleep(0.5) impedance_motion.target = Affine(y=0.15) * initial_target print('set new target: ', impedance_motion.target)
from argparse import ArgumentParser from frankx import Affine, Robot, WaypointMotion, Waypoint 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) gripper = robot.get_gripper() robot.set_default_behavior() robot.recover_from_errors() robot.set_dynamic_rel(0.2) home_left = Waypoint(Affine(0.480, -0.15, 0.40), 1.65) home_right = Waypoint(Affine(0.450, 0.05, 0.35), 1.65) motion = WaypointMotion([home_left], return_when_finished=False) thread = robot.move_async(motion) gripper_thread = gripper.move_unsafe_async(0.05) for new_affine, new_width in [(home_right, 0.02), (home_left, 0.07), (home_right, 0.0)]: input('Press enter for new affine (also while in motion!)\n') motion.set_next_waypoint(new_affine) gripper_thread = gripper.move_unsafe_async(new_width)
from frankx import Affine, Comparison, JointMotion, LinearRelativeMotion, Measure, MotionData, Reaction, Robot if __name__ == '__main__': # Connect to the robot robot = Robot("172.16.0.2") 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.11), -0.2) motion_down_data = MotionData().with_reaction( Reaction(Measure.ForceZ, Comparison.Less, -5.0, LinearRelativeMotion(Affine(0.0, 0.0, 0.002), 0.0, 2.0))) # motion_down_data = MotionData().with_reaction(Reaction(Measure.ForceZ < -5.0, LinearRelativeMotion(Affine(0.0, 0.0, 0.002), 0.0, 2.0))) robot.move(motion_down, motion_down_data)
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))
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.05) # Define and move forwards camera = Affine(-0.079, -0.0005, 0.011, 0.0, 0.0, 0.0) # camera = Affine(-0.079, -0.0005, 0.011, -np.pi / 4, 0.0, -np.pi) home = Affine(0.480, -0.025, 0.21, 0.0) robot.move(camera, LinearMotion(home))
from argparse import ArgumentParser from frankx import Affine, JointMotion, LinearMotion, 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() # Connect to the robot robot = Robot(args.host) robot.set_default_behavior() robot.recover_from_errors() robot.set_dynamic_rel(0.15) # Joint motion robot.move( JointMotion([ -1.811944, 1.179108, 1.757100, -2.14162, -1.143369, 1.633046, -0.432171 ])) # Define and move forwards camera = Affine(y=0.05) home = Affine(0.480, -0.05, 0.40) robot.move(camera, LinearMotion(home, 1.75))
from frankx import Affine, LinearRelativeMotion, Robot # Connect to the robot robot = Robot("172.16.0.2") robot.recover_from_errors() # Reduce the acceleration and velocity dynamic robot.set_dynamic_rel(0.05) # Define and move forwards way = Affine(0.0, 0.2, 0.0) motion_forward = LinearRelativeMotion(way) robot.move(motion_forward) # And move backwards using the inverse motion motion_backward = LinearRelativeMotion(way.inverse()) robot.move(motion_backward)
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 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, Robot, Waypoint, WaypointMotion 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 = WaypointMotion([ Waypoint(Affine(0.0, 0.0, -0.12), -0.2, Waypoint.Relative), Waypoint(Affine(0.08, 0.0, 0.0), 0.0, Waypoint.Relative), Waypoint(Affine(0.0, 0.1, 0.0, 0.0), 0.0, Waypoint.Relative), ])
from argparse import ArgumentParser from time import sleep from frankx import Affine, JointMotion, LinearRelativeMotion, ImpedanceMotion, Robot, Measure, MotionData, Reaction, 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() robot = Robot(args.host) 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) linear_motion = LinearRelativeMotion(Affine(z=-0.19), -0.3) linear_motion_data = MotionData().with_reaction( Reaction(Measure.ForceZ < -8.0, StopMotion())) # [N] robot.move(linear_motion, linear_motion_data) # Define and move forwards impedance_motion = ImpedanceMotion(800.0, 80.0)
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)
from argparse import ArgumentParser from frankx import Affine, PathMotion, 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() # Connect to the robot robot = Robot(args.host) robot.set_default_behavior() robot.recover_from_errors() # Reduce the acceleration and velocity dynamic robot.set_dynamic_rel(0.2) # Define and move forwards motion = PathMotion([ Affine(0.5, 0.0, 0.35), Affine(0.5, 0.0, 0.24, -0.3), Affine(0.5, -0.2, 0.35), ], blend_max_distance=0.05) robot.move(motion)