-
Notifications
You must be signed in to change notification settings - Fork 112
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
fuse -> ROS 2 fuse_core : Parameters and Tests #286
fuse -> ROS 2 fuse_core : Parameters and Tests #286
Conversation
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: methylDragon <methylDragon@gmail.com> Authored-by: Brett Downing - moves publishers mostly to ros2 APIs - adds convenience functions - start building publishers and models - builds and links as shared libraries - uses ros2 services for optimizer reset - removes redundant diagnostic updater timer - adds ParameterDescriptors to load parameter descriptions - adds a rough compatibility patch for ros1 style parameters - loads sensor models and publishers with ros2 - loads motion_models from ros2 params - add descriptions to CLI parameter tools - makes config files slightly closer to ROS1 layout - fixes type errors - cleanup, deprecate XmlRpc API for parameters - uses Node directly in parameter helpers to simplify the port - add missing dependency - Adding Ceres options - Adding more classes to the CMakeLists - converts stored parameters to double, allowing dynamic reconf - uses rclcpp::ok - binds timer callbacks - tweaks order of arguments - fix params and chrono, build fuse_graphs - change params, fix chrono, build fuse_graphs
Signed-off-by: methylDragon <methylDragon@gmail.com> Authored-by: Brett Downing - moves publishers mostly to ros2 APIs - adds convenience functions - start building publishers and models - builds and links as shared libraries - uses ros2 services for optimizer reset - removes redundant diagnostic updater timer - adds ParameterDescriptors to load parameter descriptions - adds a rough compatibility patch for ros1 style parameters - loads sensor models and publishers with ros2 - loads motion_models from ros2 params - add descriptions to CLI parameter tools - makes config files slightly closer to ROS1 layout - fixes type errors - cleanup, deprecate XmlRpc API for parameters - uses Node directly in parameter helpers to simplify the port - add missing dependency - Adding Ceres options - Adding more classes to the CMakeLists - converts stored parameters to double, allowing dynamic reconf - uses rclcpp::ok - binds timer callbacks - tweaks order of arguments - fix params and chrono, build fuse_graphs - change params, fix chrono, build fuse_graphs
Signed-off-by: methylDragon <methylDragon@gmail.com>
Signed-off-by: methylDragon <methylDragon@gmail.com>
Ceres added this argument in ceres-solver/ceres-solver@e7a3035 we need to pass it else template substitution fails.
Upstream commit made me assume kGlobalSize, but that threw at runtime when the tests ran. This seems to work, also put a using statement there to make roslint happy.
Signed-off-by: methylDragon <methylDragon@gmail.com>
fde4286
to
ec59f4d
Compare
260dcb3
to
0b66a96
Compare
0b66a96
to
1d9e8fd
Compare
Signed-off-by: methylDragon <methylDragon@gmail.com>
1d9e8fd
to
de22e91
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick feedback - will come back to review parameters use and tests
51dbb91
to
329a3dc
Compare
Wait a sec.. that caused a test regression :X With these changes merged into the downstream PRs, no non-lint tests are broken. |
Signed-off-by: methylDragon <methylDragon@gmail.com>
329a3dc
to
67c6fd9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bunch of small comments! I still have 6 more files to review.
rclcpp::Time wait_time_elapsed = rclcpp::Clock(RCL_SYSTEM_TIME).now() + rclcpp::Duration::from_seconds(10.0); | ||
while (!publisher.callback_processed && rclcpp::Clock(RCL_SYSTEM_TIME).now() < wait_time_elapsed) | ||
rclcpp::Time wait_time_elapsed = | ||
rclcpp::Clock(RCL_SYSTEM_TIME).now() + rclcpp::Duration::from_seconds(10.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, I'd recommend constructing the clock once and then using it.
{ | ||
rclcpp::sleep_for(rclcpp::Duration::from_seconds(0.1)); | ||
rclcpp::sleep_for(std::chrono::milliseconds(100)); | ||
} | ||
EXPECT_TRUE(publisher.callback_processed); | ||
} | ||
|
||
int main(int argc, char** argv) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, i think the whole int main()
function can be deleted since ament_add_gtest
links to gtest_main.
@@ -121,12 +136,5 @@ TEST(AsyncSensorModel, SendTransaction) | |||
int main(int argc, char** argv) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, same comment about int main()
can be deleted.
@@ -120,12 +135,5 @@ TEST(AsyncMotionModel, ApplyCallback) | |||
int main(int argc, char** argv) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit same comment about int main()
std::string default_value = ""; | ||
value = getParam(interfaces, key, default_value); | ||
|
||
if (value == default_value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the value was explicitly set to empty string?
This might have to use one of the decalare_parameter()
overrides that doesn't accept a default value. It looks like the second getParam()
above already implements that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually all of the declare_parameter signatures require a default value... The one with value.get_type()
just uses the default constructed value of that type (which is an empty string)... I'm not sure how you'd distinguish between the two in this case :/
You have to declare a param before you can query it, and declaring it requires the input of a default value.
fuse_core/src/ceres_options.cpp
Outdated
{ | ||
rcl_interfaces::msg::ParameterDescriptor tmp_descr; | ||
|
||
std::string namespace_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, namespace_
with a trailing underscore means "member variable" (in ROS 2 style via Google Style guide).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I was trying to get around the keyword namespace
, I'll rename it to ns
instead then.
fuse_core/src/ceres_options.cpp
Outdated
} else { | ||
namespace_ = namespace_string + "."; | ||
} | ||
|
||
#if CERES_VERSION_AT_LEAST(1, 13, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libceres-dev is version 1.13.0 in Bionic - since we're targeting Rolling I think it's safe to remove this check.
fuse_core/src/ceres_options.cpp
Outdated
namespace_ + "enable_fast_removal", problem_options.enable_fast_removal, tmp_descr | ||
); | ||
|
||
tmp_descr.description = "If true, trades memory for faster Problem::RemoveResidualBlock()"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this description was copied from the above, and it seems different from upstream's description:
50dfe90
to
fb126b2
Compare
dc149ff
to
d126a1e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the way through re-reviewing, only one comment so far!
d126a1e
to
5367431
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last two comments!
@pytest.fixture | ||
def test_proc(): | ||
test_root = os.path.join( | ||
get_package_prefix('fuse_core'), '..', '..', 'build', 'fuse_core', 'test' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this assumes the test is being run after being built with colcon, with the default name for the build directory. It also assumes the software has been installed. I would recommend not using get_package_prefix()
at all. There are at least a couple good alternatives.
One alternative would be to set the WORKING_DIRECTORY
argument to ament_add_pytest_test
to ${CMAKE_CURRENT_SOURCE_DIR}
and use a relative path.
Another alternative would be to use the ENV
arugment to pass in the path to the parameters file as an environment variable and use that as the path here.
def test_no_failed_gtests(test_proc, launch_context): | ||
def validate_output(output): | ||
assert '[ PASSED ] 2 tests.' in output.splitlines(), ( | ||
'process never printed required passes') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the test is returning RUN_ALL_TESTS();
. I'd bet the exit code would be non-zero on failure, and so that could be the check here.
5367431
to
ccdca17
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The substance looks good to me, just nits about unused imports
ccdca17
to
bb0383a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last important change - the package.xml
needs a <test_depend>launch_pytest</test_depend>
Signed-off-by: methylDragon <methylDragon@gmail.com>
bb0383a
to
89147de
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
All tests pass except cpplint, uncrustify, and xmllint. Approving since linting is to be fixed in the next PR.
See: #276
Description
With this PR, tests now run (and pass) on
fuse_core
! (Sans linting)This PR incorporates all remaining changes @BrettRD made to fuse_core, and then applies patches on top of them to fix parameters and the tests.
Additionally, it brings in changes from #273 to allow for Ceres support in the tests. (That PR's been merged but not on the rolling branch. I've cherry-picked the changes.)
Also, this PR adds the
NodeInterfaces
class proposed in ros2/rclcpp#2041 tofuse_core
, to port passing of ROS node handles around.Notes
Pinging @svwilliams for visibility.