diff --git a/crazyflie_py/crazyflie_py/crazyflie.py b/crazyflie_py/crazyflie_py/crazyflie.py index 03055a8bc..025cac736 100644 --- a/crazyflie_py/crazyflie_py/crazyflie.py +++ b/crazyflie_py/crazyflie_py/crazyflie.py @@ -45,8 +45,7 @@ class TimeHelper: When running on real hardware, this class uses ROS time functions. The simulation equivalent does not depend on ROS. - Attributes - ---------- + Attributes: visualizer: No-op object conforming to the Visualizer API used in simulation scripts. Maintains the property that scripts should not know/care if they are running in simulation or not. @@ -104,10 +103,9 @@ def __init__(self, node, cfname, paramTypeDict): Construct Crazyflie. Args: - ---- - node: ROS node reference - cfname (string): Name of the robot names[ace] - paramTypeDict: dictionary of the parameter types + node: ROS node reference. + cfname (string): Name of the robot names[ace]. + paramTypeDict: dictionary of the parameter types. """ prefix = '/' + cfname @@ -345,7 +343,6 @@ def goTo(self, goal, yaw, duration, relative=False, groupMask=0): controller to become unstable. Args: - ---- goal (iterable of 3 floats): The goal position. Meters. yaw (float): The goal yaw angle (heading). Radians. duration (float): How long until the goal is reached. Seconds. @@ -444,7 +441,6 @@ def notifySetpointsStop(self, remainValidMillisecs=100, groupMask=0): streaming setpoint modes. Args: - ---- remainValidMillisecs (int): Number of milliseconds that the last streaming setpoint should be followed before reverting to the onboard-determined behavior. May be longer e.g. if one radio @@ -503,7 +499,6 @@ def setParam(self, name, value): See :meth:`getParam()` docs for overview of the parameter system. Args: - ---- name (str): The parameter's name. value (Any): The parameter's value. @@ -547,7 +542,6 @@ def cmdFullState(self, pos, vel, acc, yaw, omega): :meth:`goTo()` after a streaming setpoint has been sent. Args: - ---- pos (array-like of float[3]): Position. Meters. vel (array-like of float[3]): Velocity. Meters / second. acc (array-like of float[3]): Acceleration. Meters / second^2. @@ -702,8 +696,7 @@ class CrazyflieServer(rclpy.node.Node): Also is the container for the individual :obj:`Crazyflie` objects. - Attributes - ---------- + Attributes: crazyfiles (List[Crazyflie]): List of one Crazyflie object per robot, as determined by the crazyflies.yaml config file. crazyfliesById (Dict[int, Crazyflie]): Index to the same Crazyflie @@ -873,7 +866,6 @@ def goTo(self, goal, yaw, duration, groupMask=0): See docstring of :meth:`Crazyflie.goTo()` for additional details. Args: - ---- goal (iterable of 3 floats): The goal offset. Meters. yaw (float): The goal yaw angle (heading). Radians. duration (float): How long until the goal is reached. Seconds. @@ -898,7 +890,6 @@ def startTrajectory(self, trajectoryId, Asynchronous command; returns immediately. Args: - ---- trajectoryId (int): ID number as given to :meth:`Crazyflie.uploadTrajectory()`. timescale (float): Scales the trajectory duration by this factor. For example if timescale == 2.0, the trajectory will take twice @@ -946,7 +937,6 @@ def cmdFullState(self, pos, vel, acc, yaw, omega): :meth:`goTo()` after a streaming setpoint has been sent. Args: - ---- pos (array-like of float[3]): Position. Meters. vel (array-like of float[3]): Velocity. Meters / second. acc (array-like of float[3]): Acceleration. Meters / second^2. diff --git a/crazyflie_py/crazyflie_py/util.py b/crazyflie_py/crazyflie_py/util.py index 602862b5b..2c201ff9c 100644 --- a/crazyflie_py/crazyflie_py/util.py +++ b/crazyflie_py/crazyflie_py/util.py @@ -10,12 +10,10 @@ def check_ellipsoid_collisions(positions, radii): Check for collisions between a set of ellipsoids at given positions. Args: - ---- positions (array float[n, 3]): The ellipsoid centers. radii (array float[3]): The radii of the axis-aligned ellipsoids. - Returns - ------- + Returns: colliding (array bool[n]): True at index i if the i'th ellipsoid intersects any of the other ellipsoids. @@ -38,13 +36,11 @@ def poisson_disk_sample(n, dim, mindist): TODO(jpreiss): find/implement a library with a fast algorithm. Args: - ---- n (int): Number of points. dim (int): Dimensionality of points. mindist (float): Minimum Euclidean distance between any two points. - Returns - ------- + Returns: pts (array float[n, dim]): The sampled points. """ diff --git a/crazyflie_py/test/test_pep257.py b/crazyflie_py/test/test_pep257.py index b234a3840..bd90b5f8e 100644 --- a/crazyflie_py/test/test_pep257.py +++ b/crazyflie_py/test/test_pep257.py @@ -19,5 +19,5 @@ @pytest.mark.linter @pytest.mark.pep257 def test_pep257(): - rc = main(argv=['.', 'test']) + rc = main(argv=['.', 'test', '--add-ignore', 'D406', 'D407', 'D417']) assert rc == 0, 'Found code style errors / warnings' diff --git a/docs2/howto.rst b/docs2/howto.rst index abdeecc1c..7c214d872 100644 --- a/docs2/howto.rst +++ b/docs2/howto.rst @@ -90,4 +90,15 @@ To close the logblocks again, run: .. code-block:: bash ros2 service call /cf2/remove_logging crazyflie_interfaces/srv/RemoveLogging "{topic_name: 'topic_test'}" - ros2 service call /cf2/remove_logging crazyflie_interfaces/srv/RemoveLogging "{topic_name: 'pose'}" \ No newline at end of file + ros2 service call /cf2/remove_logging crazyflie_interfaces/srv/RemoveLogging "{topic_name: 'pose'}" + +Run Tests Locally +----------------- + +This requires some updated pip packages for testing, see https://docs.ros.org/en/humble/Installation/Alternatives/Ubuntu-Development-Setup.html, otherwise the reported failures will be inconsistent with CI. + +Then execute: + +``` +colcon test --event-handlers=console_cohesion+ --return-code-on-test-failure --packages-select crazyflie_py +```