Skip to content

Commit

Permalink
[agents] there can be only one ....
Browse files Browse the repository at this point in the history
  • Loading branch information
stonier committed Jun 27, 2018
1 parent 809ad5b commit b5d9ad2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
5 changes: 3 additions & 2 deletions include/delphyne/mi6/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ target_include_directories(
mi6
INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/${PROJECT_NAME}${PROJECT_MAJOR_VERSION}>
$<INSTALL_INTERFACE:include/${PROJECT_NAME}>
)

target_link_libraries(public_headers
target_link_libraries(mi6
INTERFACE
public_headers
drake::drake
)

Expand Down
25 changes: 19 additions & 6 deletions include/delphyne/mi6/agent_diagram_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,31 @@ class AgentDiagramBuilder : public drake::systems::DiagramBuilder<T> {

/// @brief Export the specified state output port.
void ExportStateOutput(const drake::systems::OutputPort<T>& output) {
DELPHYNE_VALIDATE(
outputs_.count("state") == 0,
std::runtime_error,
"A state output port has already been exported and this diagram "
"enforces that there can be only one.");
outputs_["state"] = this->ExportOutput(output);
}

/// @brief Export the specified posee output port.
/// @brief Export the specified pose output port.
void ExportPoseOutput(const drake::systems::OutputPort<T>& output) {
DELPHYNE_VALIDATE(
outputs_.count("pose") == 0,
std::runtime_error,
"A pose output port has already been exported and this diagram "
"enforces that there can be only one.");
outputs_["pose"] = this->ExportOutput(output);
}

/// @brief Export the specified velocity output port.
void ExportVelocityOutput(const drake::systems::OutputPort<T>& output) {
DELPHYNE_VALIDATE(
outputs_.count("velocity") == 0,
std::runtime_error,
"A velocity output port has already been exported and this diagram "
"enforces that there can be only one.");
outputs_["velocity"] = this->ExportOutput(output);
}

Expand All @@ -85,11 +100,9 @@ class AgentDiagramBuilder : public drake::systems::DiagramBuilder<T> {

/// @brief Build the diagram bundle and append the indices.
std::unique_ptr<DiagramBundle<T>> Build() {
// TODO(daniel.stonier) check that all indices have been set
// outputs: "state", "pose", "velocity"
// inputs: "traffic_poses"
// Consider putting the check in a AgentDiagramBundle::Validate()
// which would be a subclass of DiagramBundle
// Check that all indices have been set
// inputs: "traffic_poses"
// outputs: "state", "pose", "velocity"
DELPHYNE_VALIDATE(
outputs_.count("state") == 1,
std::runtime_error,
Expand Down

0 comments on commit b5d9ad2

Please sign in to comment.