-
Notifications
You must be signed in to change notification settings - Fork 63
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
Add a customizable frame prefix ros param and unify the default fallback in param interface #506
base: main
Are you sure you want to change the base?
Add a customizable frame prefix ros param and unify the default fallback in param interface #506
Conversation
Looks like there are some problems with access rights. Probably again related to this being an external PR? Build and push docker image fails with:
|
Regarding the It would not have to do any of the fancy key manipulation, as the current design always just expects a wild-carded config file. It would simply check if the launch parameters are set and if so, substitute their values into the ones from the given config file. If no config file was used, it would output an empty configuration with only those corresponding parameters set. Otherwise, we either have an empty config or pass the provided config file as is. |
cdec4eb
to
4fd5796
Compare
@tcappellari-bdai I have implemented a small launch utility to work with the launch arguments. The I've updated the interface tests and rebased onto the latest |
…parameters API for easier customizability. * reduced ambiguity when handling the robot name and frame prefix (exposed as explicit ros params) - maintaining the original namespace semantics if frame prefix is not explicitly specified * added a getFramePrefix() method to parameter interface - returns an optional value from the frame_prefix argument * added a getFramePrefixWithDefaultFallback() to the parameter interface - returns a valid prefix based on the frame_prefix and/or robot_name arguments or an empty string * refactored DefaultImageClient, DefaultSpotApi, and the decompress image utils to use the more explicit frame_prefix argument instead of robot_name * exported the local stripPrefix function from object synchronizer to robot state conversions for reusability * SpotImagePublisher, Kinematic, ObjectSynchronizer, and StatePublisher nodes now all use the single getFramePrefixWithDefaultFallback method to get the prefix instead of each creating it independently
…ace with robot name and frame prefix. * created the initialize() method to handle all interface initializations * added a frame_prefix argument to the RclcppCameraHandle class constructor - should be acquired from the parameter interface * wrapped the internal stitcher class into a unique pointer
…issing preferred_odom_frame to general spot config tests. * default behavior without spot_name and frame_prefix parameters should still be preserved * verifying that the spot_name parameter is correctly used when specified * verifying that the frame_prefix parameter is correctly used when specified * verifying that all fallback behaviors work as expected
…unch file arguments. * implemented a parameter substitution launch helper util, which passes the given launch arguments into the used parameter configuration * substitution values are type-constrained explicitly to LaunchSubstitution * all type handling is offloaded to the internal ros substitution mechanisms - is usable for any ros parameter type * launch parameters will always take precedence over config file parameters * updated rviz launch to use the prefix argument correctly * updated relevant README files * minor fix - redefined lambda in parameter interface test as a static expression
b55c710
to
919e247
Compare
919e247
to
8f8e599
Compare
@Imaniac230 just letting you know that I haven't forgotten about this PR and I'm still working to get it to work with our current researchers' set-ups so as not to interrupt their workflow :) |
@tcappellari-bdai thanks for the update. I took a second look at it now after a while, and there are some things that are not quite right. I want to test them in more detail, so I reverted it into a draft in the meantime. P.S.: Sorry for the force-push. |
…validation checks for preferred_odom_frame in cpp nodes. * Fixed incorrect usage of the spot_name parameter in spot_driver.launch if given as an empty string - do not try to create a prefix from the empty name. * Fixed incorrect usage of the frame_prefix parameter in spot_ros2 if not set - empty string cannot be used as a default value, since it is also used as a valid prefix option. * Implemented a validatePreferredOdomFrame() function in cpp conversion utils for checking if the given preferred_odom_frame can be used as a valid option in state_publisher and object_synchronizer - if it is not valid, the nodes will use a default option and output a warning message. * Implemented a prependPrefix() function in conversion utils. * Extended the spot_ros2 error message to print out the full list of all valid preferred_odom_frame options. * Added some explanations to the parameters in config and commented out frame_prefix by default. * Implemented tests for all prefix handling utils - stripPrefix(), prependPrefix(), validatePreferredOdomFrame(). Signed-off-by: Imaniac230 <[email protected]>
…itution, implement tests for prefix and name argument handling in launch files and the spot_ros2 python node. * The spot name and frame prefix handling was ported from the launchfiles into a separate get_name_and_prefix launch helper util. * Refactored argument and return types of substitute_launch_parameters to the base Substitution type instead of LaunchConfiguration. * Implemented unit tests for the added substitute_launch_parameters and get_name_and_prefix utils. * Added a new test in test_ros_interfaces to check that the frame_prefix and preferred_odom_frame in spot_ros2 are correctly set using the spot_name. Signed-off-by: Imaniac230 <[email protected]>
Summary of changes made in 3f2d35a and 10ca6ae. There were two bugs I had here:
Additional fixes: The error message for spot_ros2/spot_driver/spot_driver/spot_ros2.py Lines 355 to 368 in 796bf25
This could be misleading, since the non-prefixed odom and vision options are always supposed to be valid. Originally, this actually failed if the preferred_odom_frame was given as just odom or vision , which was fixed in previous commits.
The cpp nodes spot_ros2/spot_driver/src/robot_state/state_publisher.cpp Lines 36 to 39 in 796bf25
So, even though the spot_ros2 node would fail with an error by design, these would launch without any warnings about an invalid odom frame. And, since the prefix could now be virtually any string, the parsing with the '/' character would also not be sufficient anymore.
In general, all three nodes ( One thing I'm not sure about is this section: spot_ros2/spot_driver/src/conversions/robot_state.cpp Lines 149 to 152 in 796bf25
If I understand it correctly, these frames are coming directly from the robot messages. So it should never happen that they would be pre-pended with the prefix for ROS frames? Once I get to the physical robot I will check that I didn't break anything with these new changes and mark this as ready. Also, I think that additional integration tests for
And this comment is now longer that I expected it to be. |
…correctly, remove forgotten local fixme comment. Signed-off-by: Imaniac230 <[email protected]>
Change Overview
Hi,
I have updated the parameter interface with a new
frame_prefix
parameter that would allow to explicitly define the prefix for all frames. I have integrated thespot_name
parameter into the interface as well.I believe this would be useful especially in these cases:
/spot/chassis/
and/spot/sensors/
), which is not possible with the current default behaviorThe
spot_driver.launch.py
launch file does expose atf_prefix
parameter, however, it only effects the static transforms from the model URDF file. All dynamic transforms from the actual spot nodes were still broadcasting the default prefix, which was somewhat confusing when the driver was launched with a specific desired value in thetf_prefix
launch param and was not behaving as expected.The proposed new behavior would:
spot_name + '/'
prefix with a fallback to the node namespace if robot name is also not given (this is essentially identical to the original behavior).The actual prefix construction logic in cpp nodes was also exported directly into a method in the parameter interface. This way all nodes can use the single definition instead of creating it independently at various different places.
Summary
getFramePrefix()
method to parameter interface - returns an optional value from theframe_prefix
argumentgetFramePrefixWithDefaultFallback()
to the parameter interface - returns a valid prefix based on theframe_prefix
and/orrobot_name
arguments or an empty string - this is the single place where all nodes should source the prefix fromDefaultImageClient
,DefaultSpotApi
, and the decompress image utils to use the more explicitframe_prefix
argument instead ofrobot_name
stripPrefix()
function from object synchronizer to robot state conversions for reusabilitySpotImagePublisher
,Kinematic
,ObjectSynchronizer
,StatePublisher
, andImageStitcher
nodes now all use the singlegetFramePrefixWithDefaultFallback()
method to get the prefix instead of each creating it independentlyCurrently, I removed thetf_prefix
andspot_name
launch arguments fromspot_image_publishers.launch.py
andspot_driver.launch.py
, but I'm guessing that they should probably be preserved for cases when a config file is not used at all?I haven't updated any tests yet, nor added any meaningful new ones, but I would be happy to receive any feedback on whether this whole proposal is even something that would actually be desired.Testing Done
I have verified the behaviors with different scenarios experimentally with a robot:
ros2 launch spot_driver spot_driver.launch.py config_file:=spot_ros2/spot_driver/config/spot_ros_example.yaml stitch_front_images:=True
This will also have to go in hand with a small addition to the
Wrapper
constructor here: Imaniac230/spot_wrapper@eb1dc6dTODO
Add tests for additional scenarios:
Maintain consistent compatibility with the original launch file arguments:
Finally: