6 from crazyflie_driver.msg
import TrajectoryPolynomialPiece
9 return geometry_msgs.msg.Point(a[0], a[1], a[2])
16 rospy.wait_for_service(prefix +
"/set_group_mask")
18 rospy.wait_for_service(prefix +
"/takeoff")
20 rospy.wait_for_service(prefix +
"/land")
22 rospy.wait_for_service(prefix +
"/stop")
24 rospy.wait_for_service(prefix +
"/go_to")
25 self.
goToService = rospy.ServiceProxy(prefix +
"/go_to", GoTo)
26 rospy.wait_for_service(prefix +
"/upload_trajectory")
28 rospy.wait_for_service(prefix +
"/start_trajectory")
30 rospy.wait_for_service(prefix +
"/update_params")
36 def takeoff(self, targetHeight, duration, groupMask = 0):
37 self.
takeoffService(groupMask, targetHeight, rospy.Duration.from_sec(duration))
39 def land(self, targetHeight, duration, groupMask = 0):
40 self.
landService(groupMask, targetHeight, rospy.Duration.from_sec(duration))
42 def stop(self, groupMask = 0):
45 def goTo(self, goal, yaw, duration, relative = False, groupMask = 0):
47 self.
goToService(groupMask, relative, gp, yaw, rospy.Duration.from_sec(duration))
51 for poly
in trajectory.polynomials:
52 piece = TrajectoryPolynomialPiece()
53 piece.duration = rospy.Duration.from_sec(poly.duration)
54 piece.poly_x = poly.px.p
55 piece.poly_y = poly.py.p
56 piece.poly_z = poly.pz.p
57 piece.poly_yaw = poly.pyaw.p
61 def startTrajectory(self, trajectoryId, timescale = 1.0, reverse = False, relative = True, groupMask = 0):
65 self.tf.waitForTransform(
"/world",
"/cf" +
str(self.id), rospy.Time(0), rospy.Duration(10))
66 position, quaternion = self.tf.lookupTransform(
"/world",
"/cf" +
str(self.id), rospy.Time(0))
67 return np.array(position)
70 return rospy.get_param(self.
prefix +
"/" + name)
73 rospy.set_param(self.
prefix +
"/" + name, value)
77 for name, value
in params.iteritems():
78 rospy.set_param(self.
prefix +
"/" + name, value)
def land(self, targetHeight, duration, groupMask=0)
def goTo(self, goal, yaw, duration, relative=False, groupMask=0)
def uploadTrajectory(self, trajectoryId, pieceOffset, trajectory)
def stop(self, groupMask=0)
def __init__(self, prefix, tf)
def setGroupMask(self, groupMask)
def setParam(self, name, value)
def takeoff(self, targetHeight, duration, groupMask=0)
def setParams(self, params)
def startTrajectory(self, trajectoryId, timescale=1.0, reverse=False, relative=True, groupMask=0)
def arrayToGeometryPoint(a)