Practical Course 1


In [1]:
import sys
sys.path.append('../../rai/rai/ry')
import libry as ry
import numpy as np

In [2]:
C = ry.Config()
D = C.view()
C.clear()
C.addFile('../../rai-robotModels/baxter/baxter_new.g')

In [3]:
C.addObject(name='object', shape=ry.ST.capsule, size=[.2,.05], pos=[.8,0,1.], color=[1,1,0])


Out[3]:
<libry.Frame at 0x7f7723fb5d50>

In [4]:
q_home = C.getJointState();
q_zero = 0. * q_home

In [5]:
#CALL THIS TO COMMUNICATE TO ROS AND BAXTER
B = C.operate("myRosNodeNameMarc")

In [6]:
#CALL THIS TO WORK IN SIMULATION ONLY
B = C.operate("")

In [6]:
# this syncs C to be in state of the B
B.sync(C)

In [7]:
B.move([q_zero], [ 10.], False)

In [8]:
B.moveHard(q_home)

In [9]:
# operate the gripper:
q_home[-1] = 0; #-1 = suction, -2=gripper;  0=open, 1=close
B.moveHard(q_home)

In [8]:
# get info on whether the gripper is open
B.getGripperOpened('left')


Out[8]:
True

In [10]:
# is there really an object in the gripper?
B.getGripperGrabbed('left')


Out[10]:
False

In [15]:
#clean up all objects
B=0
D=0
K=0

In [10]:
# deactivate sending motion commands to baxter
B.sendToReal(False)

In [ ]: