def __init__(self, ip, joy_topic="/cmd_vel", scale = 0.005): self.robot = robot_controller.Ur3(ip, 30003, 30002) self.sub = message_filters.Subscriber(joy_topic, Twist) self.cache = message_filters.Cache(self.sub, cache_size=1, allow_headerless=True) self.scale = scale self.last_pose = self.robot.get_pose() self.bounds_x = (0.225, -0.225) self.bounds_y = (0.315, -0.315)
def __init__(self, robot_ip, joy_topic="/joy", gripper_topic="/gripper/command", scale=0.001): print('Connecting to {}'.format(robot_ip)) self.robot = robot_controller.Ur3(robot_ip, 30003, 30002) self.sub = message_filters.Subscriber(joy_topic, Joy) self.cache = message_filters.Cache(self.sub, cache_size=1, allow_headerless=False) self.pub = rospy.Publisher(gripper_topic, String, queue_size=2) self.scale = scale self.orient_scale = 0.01 self.last_pose = self.robot.get_pose() self.last_data_h_seq = None self.dead_zone = 0.2 self.update_count = 20 self.update_counter = 0
#! /usr/bin/env python import tools import rospy from geometry_msgs.msg import PoseStamped from std_msgs.msg import Float32MultiArray import time import robot_controller rospy.init_node('move') manipulator = robot_controller.Ur3("192.168.1.211", 30003, 30002) time.sleep(5) last_z = 1000 ok = False box = tools.set_box(manipulator) table_z = tools.set_table_z(manipulator) start = tools.set_start(manipulator) tools.check_joints(manipulator) def convert_pose(): pose = PoseStamped() pose.pose.position.z = tools.get_pose(manipulator)[2] return pose def move(pose_g): global last_z global ok
# Execute a trajetory in a force mode. # Author: Michal Bednarek # Force mode example import robot_controller # communicate with a robot manipulator = robot_controller.Ur3("150.254.47.160", 30003, 30002) force_traj = list() pose = manipulator.get_pose() pose[2] -= 0.1 for i in range(3): pose[1] += 0.05 pt = manipulator.create_move_command(pose, is_movej=False, a=0.2, v=0.2) force_traj.append(pt) print manipulator.execute_in_force_mode(force_traj)