Skip to content

Conversation

@shawnkchan
Copy link

Summary

This PR addresses #8. This branch was created from the develop branch.

In this branch:

  1. OrderGraphValidator is now isolated from OrderManager
  2. OrderGraphValidator uses the hard types in vda5050_types
  3. There is no interaction with any state logic
  4. Unit tests are passing

@shawnkchan shawnkchan requested a review from sauk2 November 24, 2025 09:15
@shawnkchan shawnkchan marked this pull request as draft November 24, 2025 09:20
Signed-off-by: Shawn Chan <[email protected]>
Copy link
Member

@sauk2 sauk2 left a comment

Choose a reason for hiding this comment

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

Thanks for the great work! I have provided my first phase of review comments.

I haven't read through the source file properly yet. These comments are mostly on the exposed API.

…and refactor is_in_traversal_order logic for easier readability

Signed-off-by: Shawn Chan <[email protected]>
Signed-off-by: Shawn Chan <[email protected]>
Signed-off-by: Shawn Chan <[email protected]>
@shawnkchan shawnkchan marked this pull request as ready for review December 1, 2025 03:33
Copy link
Member

@sauk2 sauk2 left a comment

Choose a reason for hiding this comment

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

Some more comments regarding the functional logic. I feel there are a few validation checks still missing,

  • All node sequence IDs should be even and all edge sequence IDs should be odd.
    This follows from the structure of a valid order - an order must contain at least one node (the AGV’s current position), which always starts at sequence ID 0. From there, nodes and edges should alternate.
  • The validator should ensure that no two nodes or edges share the same sequence ID. Duplicate sequence IDs would break the ordering during execution.
  • Sequence IDs should form a continuous chain with no gaps so there should be a check to search for any missing sequence IDs.
  • There should be a clear boundary between base and horizon entities. Once the first unreleased node or edge is encountered, all following nodes and edges must also be unreleased.

)
target_link_libraries(test_mqtt_client mqtt_client logger)

find_package(ament_cmake_gtest REQUIRED)
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you need to bring in ament_cmake_gtest separately. The previous ament_cmake_gmock most probably does that

Comment on lines 163 to 190
ValidationResult OrderGraphValidator::is_valid_edges(
const vda5050_types::Order& order)
{
ValidationResult res{true, {}};

std::string start_node_id = order.nodes.front().node_id;
std::string end_node_id = order.nodes.back().node_id;

for (vda5050_types::Edge e : order.edges)
{
if (e.start_node_id != start_node_id && e.end_node_id != end_node_id)
{
vda5050_types::Error invalid_edges_error{};
invalid_edges_error.error_type = "Graph Validation Error";
invalid_edges_error.error_references = {
vda5050_types::ErrorReference{"edgeId", e.edge_id}};
invalid_edges_error.error_description =
"start_node_id and end_node_id of the edge does not match the node_ids "
"of the order's first and last node respectively.";
invalid_edges_error.error_level = vda5050_types::ErrorLevel::WARNING;

res.valid = false;
res.errors = {invalid_edges_error};
return res;
}
}
return res;
}
Copy link
Member

Choose a reason for hiding this comment

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

The current validation logic seems incorrect. Right now, the code compares every edge’s start_node_id only against the first node of the order and end_node_id only against the last node of the order. However, start_node_id and end_node_id on an edge describe the two nodes that the specific edge connects, not the global start and end of the entire order.

For a linear order, the correct relationship is sequence-based, i.e, the edge with sequence ID n should connect the node with sequence ID n-1 (as its start_node_id) and the node with sequence ID n+1 (as its end_node_id)

Because this validation depends entirely on the ordering of sequence IDs, it should not be done using only the first and last node. Instead, the check should be integrated into the part of the validation where you are already confirming that sequence IDs form a proper graph. That way you can directly verify that each edge connects the two adjacent nodes it is supposed to.

@Johnarman1398 Johnarman1398 self-assigned this Dec 13, 2025
@Johnarman1398 Johnarman1398 requested a review from sauk2 December 13, 2025 12:59
@Johnarman1398
Copy link

Johnarman1398 commented Dec 13, 2025

@sauk2 For review,

implements validation for VDA5050 order graphs to ensure basic order and sequencing rules are met before execution.

Features:

  • is_valid_graph()
  1. Enforces a linear chain where Nodes = Edges + 1.
  2. Checks for parity (Nodes=Even, Edges=Odd) and continuity (no gaps in Sequence IDs)
  3. Ensures "released" nodes never appear after "unreleased" nodes.
  4. Ensure edge's start_node_id and end_node_id are correctly labelled.
  • is_valid_order_update()
  1. Logic to ensure new Order updates stitch correctly to the last released node of the base graph

Signed-off-by: John Abogado <[email protected]>
Signed-off-by: John Abogado <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants