Skip to content

feat: Add ROS Service (.srv) schema parser #12

@zhexuany

Description

@zhexuany

Issue Description

Robocodec currently supports parsing ROS message definitions (.msg files) but does not support ROS service definitions (.srv files). Services are a core ROS communication pattern used for request/response operations.

Background

A ROS service file defines three messages separated by "---":

# Example: SetBool.srv
bool data   # Request
---
bool success   # Response
string message   # Response

Proposed Solution

Extend the schema parser to handle .srv files with a new ServiceSchema type.

Requirements

  • Add srv_parser.rs module in src/schema/parser/
  • Parse service definition format (request --- response)
  • Support ROS1 and ROS2 service formats
  • Integrate with unified parser (auto-detect .srv files)
  • Add ServiceSchema type to src/schema/ast.rs
  • Support service type references in message schemas
  • Add unit tests for various service formats
  • Add integration tests with real .srv files
  • Update documentation

Acceptance Criteria

  1. Can parse standard ROS service definitions
  2. Correctly separates request and response messages
  3. Handles nested types and arrays in service definitions
  4. Round-trip parsing preserves all information

Test Cases

  • Simple services (primitive types only)
  • Services with arrays
  • Services with nested message types
  • Real-world services (e.g., std_srvs/SetBool, nav_srvs/GetPlan)

References


Priority: P1 - Core ROS completeness
Estimated effort: Low-Medium

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority-P1High priority - core completenessschemaRelated to schema parsing (msg, srv, action, IDL)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions