コード例 #1
0
ファイル: waypoints.py プロジェクト: pantor/frankx
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),
    ])

    # You can try to block the robot now.
    robot.move(motion_down)
コード例 #2
0
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)
コード例 #3
0
ファイル: linear.py プロジェクト: wngfra/frankx
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)
コード例 #4
0
    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)

    # BE CAREFUL HERE!
    # Move forward in y-direction while applying a force in z direction
    impedance_motion.add_force_constraint(z=-8.0)  # [N]
    impedance_motion.set_linear_relative_target_motion(Affine(y=0.1),
                                                       2.0)  # [m], [s]
    robot.move(impedance_motion)
コード例 #5
0
ファイル: reaction.py プロジェクト: Xiong5Heng/frankx
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)
コード例 #6
0
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))
コード例 #7
0
ファイル: home.py プロジェクト: mrkulk/frankx
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))
コード例 #8
0
ファイル: path.py プロジェクト: wngfra/frankx
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)