# It allows a user to open and close the gripper. import sys from blue_interface import BlueInterface import numpy as np import consts if __name__ == '__main__': blue = BlueInterface( consts.default_arm, consts.default_address ) #creates object of class KokoInterface at the IP in quotes with the name 'blue' opened = True try: while True: input( "Press enter to open/close the gripper. To exit, press <ctrl+c>." ) if opened: blue.command_gripper(-1.5, 20.0) print("Closing...") else: blue.command_gripper(0.0, 10.0) print("Opening...") opened = not opened except: pass blue.disable_control() blue.shutdown()
import pickle # will use to save data between program launches import sys sys.path.append('blue_interface') from blue_interface import BlueInterface # this is the API for the robot sys.path.append('../../blue_vive_tracking/scripts') from vive_tracking import ViveTracker import random import os import time import numpy as np kk = BlueInterface( "right", "hekate.cs.berkeley.edu" ) # creates object of class KokoInterface at the IP in quotes with the name 'kk' kk.disable_control( ) # this turns off any other control currently on the robot (leaves it in gravtiy comp mode) vv = ViveTracker() kk.command_gripper(2.05, .1) #This isn't working if not os.path.isfile('../results/benchmark_joint_angle_list.p'): print("You should first run 'record_positions.py") #TODO make this an actual error joint_angle_list = pickle.load( open("../results/benchmark_joint_angle_list.p", "rb") ) #uses the pickle function to read the binary file created in record_poses.py pose_list = pickle.load(open("../results/benchmark_pose_list.p", "rb")) location_list = [
import sys sys.path.append('../../../../../blue_interface') from blue_interface import BlueInterface from control_benchmarking import ControllerVis import time import matplotlib.pyplot as plt from sensor_msgs.msg import JointState from std_msgs.msg import Float64MultiArray from time import sleep control_info = ControllerVis() blu = BlueInterface("right","hekate.cs.berkeley.edu") blu.disable_control() sampling_delay = 1.0/125 # seconds, samples at about the same rate as the response is published (use rostopic hz /joint_states) sample_duration = 2 # Helper functions def record_rxn(): time_end = time.time() + sample_duration # 3 seconds from now # Initialize cmd = [] response = [] while time.time()< time_end: cmd.append(control_info.get_reference_data()) response.append(control_info.get_response_data()) sleep(sampling_delay) print "Samples collected: %d" % len(cmd)