Skip to content

Use ros2 interfaces for parameters in moveit_servo #790

Closed

Description

@tylerjw

Currently, moveit_servo uses a template function declareOrGetParam for specifying and getting parameters. Here is the file where that is done: https://github.com/ros-planning/moveit2/blob/main/moveit_ros/moveit_servo/src/servo_parameters.cpp

I would like to use the ros2 parameter interfaces directly in order to specify descriptions and types of each parameter using the ParameterDescription. An example of that is here: https://github.com/tylerjw/parameter_tools/blob/parameter_set/parameter_set/src/example_node/robot_parameters.cpp

Note that I created a ParaeterDescriptionBuilder. Copy that into servo for now and eventually, we'll find a home for it.

Steps

  • Define defaults for all parameters in servo_paramets.h in the struct
  • Copy ParaeterDescriptionBuilder into servo
  • Create a static declare servo_pareters.cpp that uses the built in ros2 interfaces for parameters
  • Use NodeParametersInterface::SharedPtr in the builder function for ServoParameters instead of the Node directly
  • Create a get function that reads the parameters into the struct fields
  • Modify the builder function for ServoParameters to use the get and declare functions you created

Activity

  1. added
    enhancement
    on Nov 9, 2021
  2. tylerjw commented on Nov 18, 2021

    @tylerjw
    MemberAuthor

    @henningkayser I'll respond here to your comment in the PR: #799 (review)

    There still is way too much boilerplate code and unnecessary duplication, inviting for user errors and frustrating debugging sessions (overstated, but still this this should be a lot simpler and shorter)

    I'm not sure it is as bad as you seem to think it is. It could be better but this doesn't seem like the largest evil in the parameter interface in ROS 2 to me.

    The descriptor constraints are somewhat useless if they don't provide the implementation for the validate function, additional_constraints are even more useless in this context

    I don't agree that the additional_constraints string is useless. I do think it would be a really nice upstream improvement for there to be an interface for declaring per-parameter validation functions. I do think having a separate string from the description for constraints is a nice part of the interface.

    The application code is responsible for handling parameter callbacks while the config itself is not being updated
    Intermixed runtime dependencies on rclcpp, this doesn't seem to go well with mock tests

    This is true. I do hope to fix this and I have a plan for how to work around this problem. I didn't include that in what I asked for in this issue to limit the amount of work needed for this.

    No support for parameter namespaces, let alone group parameter constraints which are de facto implemented in the validate function.

    This is a problem with the ros2 interface itself. There is some work to fix this though. It is more nuanced than I understand though apparently. Here is a PR where this is being discussed: ros2/rclcpp#1796

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions