-
Notifications
You must be signed in to change notification settings - Fork 312
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
Hardware Interfaces with many parameters #347
Comments
I'm "glad" to see this raised, as it was basically what I tried to get across in #340.
pedantic, but all of that is work coming from the 'upstream' I went a bit overboard in |
OK I'll stay quiet on this. How about raising the same question on ros discourse? Would help involving more ppl |
I suspect it would be easier to do the yaml inside xacro option (Option 2). Mainly because C++ isn't great at parsing, but that macro Lovro wrote looks very simple/readable. So I would vote for that (until somebody changes my mind...) |
I think I would prefer to have parameter support, or a way to load/pass a parameter structure. I don't have a solid technical reason. It's just that it's one more file to write and maintain when creating a package, and having to add extra matching parameters to a urdf or xacro (I hope I'm understanding how the macro works correctly...). It also makes the process of creating a new robot package somewhat different from how it's documented/described in other documentation, so someone coming to ros2_control would need to be aware of the extra steps. |
If I understood well solution 2 is already implemented and amount to an organization of the robot_description package ? This will not solve the problem for people who cannot modify the URDF description package of an industrial robot. |
I guess I'm not clear on where the data gets stored for Option 1. Would it go in |
Also keep in mind parameters have to be changeable at runtime. For example joint parameters for origin-offsets, direction inversion, PIDs, etc. So #1 handles this for sure, how about Option #2? I don't see a way of updating parameters in Option2 without also having option 1 since every method of option 2 amounts to loading from a file. |
From option 2, the xacro macro looks like a maintenance nightmare. We have multiple robots with very different configurations. I'd rather avoid having the create one file like this for each one. Also, using xacro as a bridge for yaml parsing does not seem right.
I much rather convert the Mind you, this can be done from the command line now using the
I agree with you, but I'd say to leave parameter dynamic reconfiguring for a following PR. |
I don't think we have to make Sensor, Actuator and/or System regular nodes, but nothing stops someone from adding Node interfaces to these classes or vice-versa deriving from Node and implementing the ros2 controls interface. I do something similar to this in my case. |
I don't know about that. I would like to have still interested but not so experienced people here. But someone who is thinking about control. Thank you all for your contributions. It seems there is a slight tendency toward adding a node to the hardware interface (Proposal 1). That is also feedback I got from some other parties. This is somehow in line with the plans to support the lifecycle of hardware components, i.e., we could use a very similar interface used for controllers and leverage lifecycle nodes in the long term. @bmagyar and @Karsten1987, now it's your turn :D What do you think about going with proposal 1 (and yes - I know - it breaks the API and ABI) |
Another thing to consider is switching from simulation to hardware easily. Something like a launch parameter (sim:=true) in ROS1 would be great. I saw there's now a separate hardware plug-in for fake components. I'm not sure how to switch between that and the real hardware plug-in. |
I will add this into examples in the next few days. |
Maybe a bit late, but I'd really like the 1st solution, support for parameters that can be changed at runtime in the hardware interface would be make life a bit easier. |
Maybe even a bit later, but this is still something we need as users of ros2_control: changing hardware_parameters at runtime in the hardware interface. is there any progress on that and if not what is the suggested workaround to achieve this? |
## Change Overview 1. standardizes gain names in the hardware interface to `k_q_p` and `k_qd_p`, same as spot sdk (https://dev.bostondynamics.com/docs/concepts/joint_control/readme) 2. allows taking in `k_q_p` and `k_qd_p` through a a parameter file. If you have a yaml that looks like this ``` /**: ros__parameters: k_q_p: [624.0, 936.0, 286.0, 624.0, 936.0, 286.0, 624.0, 936.0, 286.0, 624.0, 936.0, 286.0, 1020.0, 255.0, 204.0, 102.0, 102.0, 102.0, 16.0] k_qd_p: [5.20, 5.20, 2.04, 5.20, 5.20, 2.04, 5.20, 5.20, 2.04, 5.20, 5.20, 2.04, 10.2, 15.3, 10.2, 2.04, 2.04, 2.04, 0.32] ``` and pass it to the `spot_ros2_control.launch.py` launchfile with the arg `config_file:=<file path>`, these gains will get used in the hardware interface to stream commands. [Because ros2 control hardware interfaces don't have "true" support for parameters, ](ros-controls/ros2_control#347 gains have to be passed in as a [string through the xacro](https://github.com/ros-controls/ros2_control/blob/cb91599f8f66aaf39b7485a2f7e131157f633474/hardware_interface/include/hardware_interface/hardware_info.hpp#L182), so this also adds a helper function to assist with this conversion back to a usable vector. edge case handling: 1. if either of these params isn't set (or no config file is specified) then the default gains are used. 2. if either the gain lists defined in the parameter file is the wrong number of elements, the hardware interface will fall back to using the default gains, and a warning will be logged about this. ## Testing Done * The wiggle arm example has some slightly jerky gripper motion using the default gains. I changed the `k_qd_p` gain for the gripper joint in my parameter file from `0.32` to `1.32` and reran the example, and the gripper looked a lot smoother. * Checked edge case handling manually ### Next steps The function to translate the gains as a string into a usable vector in the hardware interface should get unit tested (SW-1148)
Integrating an existing robot into the
ros2_control
framework, an issue about parameterizing hardware interface came up. Concretely, the robot is rather complex with many sensors (FTS, cameras), tool changing system, many tools. Therefore many parameters need to be set at on start of the hardware. Inros_control
we would typically use YAML files for this and access the parameters on the parameters server. Since the hardware interface does not have access to the ROS2 Node interface inros2_control
, this is no longer possible. Therefore we decided to define parameters under theros2_control
tag in URDF. So if one often needs to change those parameters, this is very inconvenient, especially if it is expected that end-users set the concrete values for their robots (e.g., IP-addresses).I see two possibilities to make this easier:
ros2_control
library and enable RessourceManager and HardwareInterfaces to access the parameters.As users, which approach do you prefer? I would especially like to get opinions from people focusing on using the library and not developing it (@guru-florida, @olivier-stasse, @dignakov, @v-lopez, @ahcorde, @jordan-palacios, @AndyZe, @livanov93)
Sorry @bmagyar and @Karsten1987, I think we are too biased. 😀
The text was updated successfully, but these errors were encountered: