Skip to content
Open
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
2 changes: 2 additions & 0 deletions core/frontend/src/types/autopilot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export enum EndpointType {
tcpout = 'tcpout',
serial = 'serial',
zenoh = 'zenoh',
zenohraw = 'zenohraw',
}

export function vehicleTypeFromString(vehicle_type: string): Vehicle {
Expand All @@ -111,6 +112,7 @@ export function userFriendlyEndpointType(type: EndpointType): string {
case EndpointType.tcpout: return 'TCP Client'
case EndpointType.serial: return 'Serial'
case EndpointType.zenoh: return 'Zenoh'
case EndpointType.zenohraw: return 'Zenoh Raw'
default: return 'Undefined type'
}
}
Expand Down
9 changes: 9 additions & 0 deletions core/services/ardupilot_manager/autopilot_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ def __init__(self) -> None:
persistent=True,
protected=True,
),
Endpoint(
name="ZenohRaw",
owner=self.settings.app_name,
connection_type=EndpointType.ZenohRaw,
place="0.0.0.0",
argument=7117,
persistent=True,
protected=True,
),
Endpoint(
name="Internal Link",
owner=self.settings.app_name,
Expand Down
2 changes: 2 additions & 0 deletions core/services/ardupilot_manager/mavlink_proxy/Endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class EndpointType(str, Enum):
TCPClient = "tcpout"
Serial = "serial"
Zenoh = "zenoh"
ZenohRaw = "zenohraw"


@dataclass
Expand Down Expand Up @@ -43,6 +44,7 @@ def is_mavlink_endpoint(cls: Type["Endpoint"], values: Any) -> Any:
EndpointType.TCPServer,
EndpointType.TCPClient,
EndpointType.Zenoh,
EndpointType.ZenohRaw,
]:
if not (validators.domain(place) or validators.ipv4(place) or validators.ipv6(place)):
raise ValueError(f"Invalid network address: {place}")
Expand Down
22 changes: 15 additions & 7 deletions core/services/ardupilot_manager/mavlink_proxy/MAVLinkServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,26 @@ def _get_version(self) -> Optional[str]:
def assemble_command(self, master_endpoint: Endpoint) -> str:
# Convert endpoint format to mavlink-router format
def convert_endpoint(endpoint: Endpoint) -> str:
endpoint_str = None

if endpoint.connection_type == EndpointType.Serial:
return f"serial:{endpoint.place}:{endpoint.argument}"
endpoint_str = f"serial:{endpoint.place}:{endpoint.argument}"
if endpoint.connection_type == EndpointType.TCPServer:
return f"tcps:{endpoint.place}:{endpoint.argument}"
endpoint_str = f"tcps:{endpoint.place}:{endpoint.argument}"
if endpoint.connection_type == EndpointType.TCPClient:
return f"tcpc:{endpoint.place}:{endpoint.argument}"
endpoint_str = f"tcpc:{endpoint.place}:{endpoint.argument}"
if endpoint.connection_type == EndpointType.UDPServer:
return f"udps:{endpoint.place}:{endpoint.argument}"
endpoint_str = f"udps:{endpoint.place}:{endpoint.argument}"
if endpoint.connection_type == EndpointType.UDPClient:
return f"udpc:{endpoint.place}:{endpoint.argument}"
endpoint_str = f"udpc:{endpoint.place}:{endpoint.argument}"
if endpoint.connection_type == EndpointType.Zenoh:
return f"zenoh:{endpoint.place}:{endpoint.argument}"
raise ValueError(f"Endpoint of type {endpoint.connection_type} not supported on MAVLink-Server.")
endpoint_str = f"zenoh:{endpoint.place}:{endpoint.argument}"
if endpoint.connection_type == EndpointType.ZenohRaw:
endpoint_str = f"zenohraw:{endpoint.place}:{endpoint.argument}"

if endpoint_str is None:
raise ValueError(f"Endpoint of type {endpoint.connection_type} not supported on MAVLink-Server.")
return endpoint_str

filtered_endpoints = Endpoint.filter_enabled(self.endpoints())
endpoints = " ".join([convert_endpoint(endpoint) for endpoint in [master_endpoint, *filtered_endpoints]])
Expand Down Expand Up @@ -70,6 +77,7 @@ def _validate_endpoint(endpoint: Endpoint) -> None:
EndpointType.TCPClient,
EndpointType.Serial,
EndpointType.Zenoh,
EndpointType.ZenohRaw,
]
Comment on lines +80 to 81

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Endpoint validation lists are duplicated; consider centralizing the allowed MAVLink endpoint types.

The valid_connection_types list here must now stay in sync with the types checked in Endpoint.is_mavlink_endpoint (e.g. ZenohRaw). Please extract a shared constant or helper (such as Endpoint.mavlink_connection_types()) so the allowed MAVLink endpoint types are defined in one place and updated consistently.

Suggested implementation:

         Endpoint.mavlink_connection_types():
             if not (validators.domain(place) or validators.ipv4(place) or validators.ipv6(place)):
        filtered_endpoints = Endpoint.filter_enabled(self.endpoints())
        valid_connection_types = Endpoint.mavlink_connection_types()
        if endpoint.connection_type not in valid_connection_types:

To fully centralize the allowed MAVLink endpoint types:

  1. Implement Endpoint.mavlink_connection_types() (likely as a @classmethod or @staticmethod) in the Endpoint class, returning the shared list of EndpointType values (including ZenohRaw).
  2. Update Endpoint.is_mavlink_endpoint to delegate to Endpoint.mavlink_connection_types() instead of maintaining its own list.
  3. Ensure any other places in the codebase that hard-code MAVLink endpoint types are updated to use Endpoint.mavlink_connection_types() for consistency.

if endpoint.connection_type not in valid_connection_types:
raise ValueError(f"Connection_type '{endpoint.connection_type}' not supported by {MAVLinkServer.name()}.")
Expand Down
2 changes: 1 addition & 1 deletion core/tools/mavlink_server/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Immediately exit on errors
set -e

VERSION="0.7.4"
VERSION="0.9.0"
PROJECT_NAME="mavlink-server"
REPOSITORY_ORG="bluerobotics"
REPOSITORY_NAME="$PROJECT_NAME"
Expand Down
Loading