Skip to content

Commit

Permalink
added callback and getter for status topic to python layer ; added in…
Browse files Browse the repository at this point in the history
…finite_flight to crazyflie_examples
  • Loading branch information
julienthevenoz committed Feb 29, 2024
1 parent 3594e93 commit d1bbb7b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crazyflie_py/crazyflie_py/crazyflie.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def __init__(self, node, cfname, paramTypeDict):
self.setParamsService = node.create_client(
SetParameters, '/crazyflie_server/set_parameters')
self.setParamsService.wait_for_service()
self.statusSubscriber = node.create_subscription(Status, f'{self.prefix}/status', self.listener_callback, 10)
self.statusSubscriber = node.create_subscription(Status, f'{self.prefix}/status', self.status_topic_callback, 10)
self.status = {}

# Query some settings
Expand Down Expand Up @@ -701,7 +701,7 @@ def cmdPosition(self, pos, yaw=0.):
# self.setParam('ring/solidGreen', int(g * 255))
# self.setParam('ring/solidBlue', int(b * 255))

def listener_callback(self, msg):
def status_topic_callback(self, msg):
"""Callback method updating the status attribute every time
a crazyflie_interfaces/msg/Status message is published on the topic /cfXXX/status """

Expand Down Expand Up @@ -1001,7 +1001,7 @@ def cmdFullState(self, pos, vel, acc, yaw, omega):
def get_statuses(self):
'''
Obtain a list containing the status of each crazyflie controlled by the Crazyserver
Each status is a dict, see listener_callback() for more details
Each status is a dict, see status_topic_callback() for more details
'''

# self.get_logger().info(f'Crazyserver.get_statuses() was called')
Expand Down

0 comments on commit d1bbb7b

Please sign in to comment.