Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build the connection validator test #455

Merged
merged 6 commits into from
Jun 10, 2020
Merged
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
24 changes: 24 additions & 0 deletions subt_ign/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,30 @@ install(TARGETS ${connection_validator_name}
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)

add_executable(validate_connections
src/validate_connections.cc
src/ConnectionValidator.cc
src/ConnectionValidatorPrivate.cc
src/ConnectionHelper.cc
src/SimpleDOTParser.cc)
target_link_libraries(validate_connections
PRIVATE
ignition-gazebo${IGN_GAZEBO_VER}::core
ignition-common3::ignition-common3
ignition-launch1::ignition-launch1
ignition-math6::ignition-math6
ignition-msgs4::ignition-msgs4
ignition-plugin1::loader
ignition-transport7::ignition-transport7
${catkin_LIBRARIES}
${protobuf_lib_name}
)
install(TARGETS validate_connections
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)


# Create the libCommsBrokerPlugin.so library.
set(comms_broker_plugin_name CommsBrokerPlugin)
add_library(${comms_broker_plugin_name}
Expand Down
15 changes: 12 additions & 3 deletions subt_ign/src/ConnectionValidatorPrivate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -327,18 +327,27 @@ void ConnectionValidatorPrivate::PopulateConnections()
{
for (auto cap: caps)
{
if (point.Equal(cap, 1))
if (point.Equal(cap, 1.0))
{
igndbg << "Found cap!" << std::endl;
found_caps += 1;
}
else if (point.Equal(cap, 12.6))
{
igndbg << "Found cap (with expanded tolerance)" << std::endl;
found_caps += 1;
}
}
}

if (actual + found_caps != data)
{
igndbg << name << " " << actualConnections[name] << "/" << data <<
" (" << this->vertData[name].tileType << ")" << std::endl;
igndbg << "Actual connections[" << actualConnections[name]
<< "] do not match expected connections[" << data
<< "] for tile name[" << name << "] with type["
<< this->vertData[name].tileType << "]. "
<< "Missing an end cap or connecting tile."
<< std::endl;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*
*/

/// Helper test to evaluate graph population without starting gazebo.
/// Call with TEST_connection_validator <world_name>
/// Helper to evaluate graph population without starting gazebo.
/// Call with `validate_connections` <world_name>
#include "ConnectionValidatorPrivate.hh"

#include <ignition/common/Console.hh>
Expand Down