diff --git a/crazyflie_examples/crazyflie_examples/infinite_flight.py b/crazyflie_examples/crazyflie_examples/infinite_flight.py index a664d9673..5dc3c359c 100644 --- a/crazyflie_examples/crazyflie_examples/infinite_flight.py +++ b/crazyflie_examples/crazyflie_examples/infinite_flight.py @@ -35,14 +35,14 @@ def main(): # fly figure8 until battery is low fig8_counter = 0 - status = allcfs.get_statuses()[0] + status = allcfs.crazyflies[0].status()# status = allcfs.get_statuses()[0] # while status['battery'] > 3.8: while status['pm_state'] == 0: fig8_counter += 1 print(f'starting figure8 number {fig8_counter} of flight number {flight_counter}') allcfs.startTrajectory(0, timescale=TIMESCALE) timeHelper.sleep(traj1.duration * TIMESCALE + 2.0) - status = allcfs.get_statuses()[0] + status = allcfs.crazyflies[0].status() # status = allcfs.get_statuses()[0] print(f'pm state : {status["pm_state"]}, battery left : {status["battery"]}') timeHelper.sleep(1) @@ -50,7 +50,7 @@ def main(): # not sure if useful # check if pm = 3 just to be sure, if not abort test if status['pm_state'] != 3: - print(f'power state is not 3 (low) but {status['pm_state']}. Landing and aborting') + print(f'power state is not 3 (low) but {status["pm_state"]}. Landing and aborting') allcfs.land(targetHeight=0.06, duration=2.0) timeHelper.sleep(3) return 1 @@ -61,7 +61,7 @@ def main(): # now that battery is low, we try to land on the pad and see if it's charging allcfs.land(targetHeight=0.06, duration=2.0) timeHelper.sleep(5) - status = allcfs.get_statuses()[0] + status = allcfs.crazyflies[0].status() # status = allcfs.get_statuses()[0] # if not charging, take off and land back again until it charges while status['pm_state'] != 1: @@ -74,7 +74,7 @@ def main(): timeHelper.sleep(2.5) allcfs.land(targetHeight=0.06, duration=2.0) timeHelper.sleep(5) - status = allcfs.get_statuses()[0] + status = allcfs.crazyflies[0].status() # status = allcfs.get_statuses()[0] # now we wait until the crazyflie is charged @@ -82,9 +82,8 @@ def main(): while status['pm_state'] != 2: print(f'not charged yet, battery at {status['battery']}V') timeHelper.sleep(60) - status = allcfs.get_statuses()[0] - ###not sure if useful - #check if it's still charging + status = allcfs.crazyflies[0].status( )#status = allcfs.get_statuses()[0] + #check if it's still charging ###not sure if this check is useful if status['pm_state'] != 1: print(f'charging interrupted, pm state : {status['pm_state']}') diff --git a/crazyflie_py/crazyflie_py/crazyflie.py b/crazyflie_py/crazyflie_py/crazyflie.py index 4e9c2543f..062a628b3 100644 --- a/crazyflie_py/crazyflie_py/crazyflie.py +++ b/crazyflie_py/crazyflie_py/crazyflie.py @@ -997,16 +997,3 @@ def cmdFullState(self, pos, vel, acc, yaw, omega): self.cmdFullStateMsg.twist.angular.y = omega[1] self.cmdFullStateMsg.twist.angular.z = omega[2] self.cmdFullStatePublisher.publish(self.cmdFullStateMsg) - - def get_statuses(self): - ''' - Obtain a list containing the status of each crazyflie controlled by the Crazyserver - Each status is a dict, see status_topic_callback() for more details - ''' - - # self.get_logger().info(f'Crazyserver.get_statuses() was called') - statuses = [] - for cf in self.crazyflies: - statuses.append(cf.get_status()) - - return statuses \ No newline at end of file