Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@
</contact>
<friction>
<ode>
<mu>1e+6</mu>
<mu2>1e+6</mu2>
<mu>1.5</mu>
<mu2>1.5</mu2>
</ode>
</friction>
</surface>
Expand Down Expand Up @@ -159,8 +159,8 @@
</contact>
<friction>
<ode>
<mu>1e+6</mu>
<mu2>1e+6</mu2>
<mu>1.5</mu>
<mu2>1.5</mu2>
</ode>
</friction>
</surface>
Expand Down Expand Up @@ -251,8 +251,8 @@
</contact>
<friction>
<ode>
<mu>1e+6</mu>
<mu2>1e+6</mu2>
<mu>1.5</mu>
<mu2>1.5</mu2>
</ode>
</friction>
</surface>
Expand Down Expand Up @@ -344,8 +344,8 @@
</contact>
<friction>
<ode>
<mu>1e+6</mu>
<mu2>1e+6</mu2>
<mu>1.5</mu>
<mu2>1.5</mu2>
</ode>
</friction>
</surface>
Expand Down
34 changes: 26 additions & 8 deletions jderobot_drones/jderobot_drones/drone_wrapper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
"""
drone_wrapper.py
Drone wrapper module.

This module provide the Dronewrapper class, which extends the DroneInterfaceBase to integrate drone control, motion references, and sensor
data handling within the JdeRobot infrastructure.
"""

import asyncio
Expand Down Expand Up @@ -28,9 +31,14 @@

class DroneWrapper(DroneInterfaceBase):
"""
Drone Wrapper
Wrapper class that interfaces a drone with the RoboticsInfrastructure.

This class manages motion references, platform state events,
sensor subscriptions, and control commands required to operate
a drone within the JdeRobot ecosystem.
"""

# Default control and safety parameters
TK_RATE = 0.1
TK_HEIGHT_MARGIN = 0.25
LAND_RATE = 0.1
Expand Down Expand Up @@ -69,19 +77,25 @@ def __init__(self, drone_id: str = "drone0", verbose: bool = False) -> None:
def get_position(self) -> List[float]:
"""Get drone position (x, y, z) in m.

:rtype: List[float]
Returns:
List[float]: Drone position as [x, y, z].
"""
return self.position

def get_velocity(self) -> List[float]:
"""Get drone speed (vx, vy, vz) in m/s.
"""Get drone position (x, y, z) in m.

:rtype: List[float]
Returns:
List[float]: Drone position as [x, y, z].
"""
return self.speed

def yaw_rate_cb(self, msg: TwistStamped):
"""Callback to update current Yaw Rate"""
"""C Callback to update the current yaw rate from localization data.

Args:
msg (TwistStamped): Twist message containing angular velocity.
"""
self.yaw_rate = msg.twist.angular.z

def get_yaw_rate(self) -> float:
Expand Down Expand Up @@ -176,7 +190,11 @@ async def call_state_event_service(
self.get_logger().error("Service call failed")

def takeoff(self, height: float):
"""Send Takeoff command with height"""
""" Command the drone to take off to a target altitude.

Args:
height (float): Target altitude in meters.
"""
if (
self.get_landed_state() == PlatformStatus.TAKING_OFF
or self.get_landed_state() == PlatformStatus.FLYING
Expand All @@ -200,7 +218,7 @@ def takeoff(self, height: float):
asyncio.run(self.call_state_event_service(PlatformStateMachineEvent.TOOK_OFF))

def land(self) -> None:
"""Send Landing command"""
"""Command the drone to land safely."""

if (
self.get_landed_state() == PlatformStatus.LANDED
Expand Down