-
Notifications
You must be signed in to change notification settings - Fork 311
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
Added GPIO parsing and test #436
Conversation
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.
Just a comment for now, because I would like to clarify the structure here.
hardware_interface/include/hardware_interface/hardware_info.hpp
Outdated
Show resolved
Hide resolved
hardware_interface/include/hardware_interface/hardware_info.hpp
Outdated
Show resolved
Hide resolved
ros2_control_test_assets/include/ros2_control_test_assets/components_urdfs.hpp
Show resolved
Hide resolved
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
ros2_control_test_assets/include/ros2_control_test_assets/components_urdfs.hpp
Show resolved
Hide resolved
Added the <joint name="joint" size="2">
<command_interface name="position"/>
<state_interface name="position"/>
</joint>
<gpio name="flange_IOS">
<command_interface name="digital_output" size="2" data_type="bool"/>
<state_interface name="analog_input" size="0 1 2"/>
</gpio>
<sensor name="ft_" size="ee table">
<state_interface name="force." size="x y z"/>
<state_interface name="torque." size="x y z"/>
</sensor> which makes:
Can be tested with ros2_control_demos/with_gpio which now initializes the joints and GPIO with the |
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.
I am not sure about all this changes... Some of them I find good, but some of them become very cryptic and implicit. Here exact comments:
<joint name="joint" size="2"> <command_interface name="position"/> <state_interface name="position"/> </joint>
I find this good. This could save much of copy-paste code for joints.
<gpio name="flange_IOS"> <command_interface name="digital_output" size="2" data_type="bool"/> <state_interface name="analog_input" size="0 1 2"/> </gpio>
Generally OK, but why there are two possibilities to specify size
. It seems that in the second case the size
is not "size" at all. Am I missing something?
<sensor name="ft_" size="ee table"> <state_interface name="force." size="x y z"/> <state_interface name="torque." size="x y z"/> </sensor>
I don't see much purpose to use this. At least not the first size
argument. Why not simply explicitly define two sensors? IMHO this part only reduces readability and clarity.
For the second part this could be OK, but why to have specified ".". Although, I think that a better approach is to use semantic components in hardware interface for this.
Yup, and my thought was that not everyone name their joints
First of all, I think having size on the interfaces themselves can be useful if we want to define a sensor to the end-effector pose for example, which contains 9 doubles. Specifying a size of 9 makes the parser create 9 interfaces. Or if one has a large set of digitally controlled valves attached at the end-effector. But I agree that I may have abused the "size" concept a bit. My idea was that what we ask for when we say
The idea was modularity with a 'suffix_range" concept, but perhaps the whole suffix range idea should have been made with
The "." is specified since it's just suffixes. Maybe I've misunderstood the semantic components, they don't need anything to be specified in the URDF? Shouldn't everything in the hardware interface parameters be reflected in the URDF? Does that mean that parameters of a semantic component wouldn't be editable without recompiling the package? |
I agree in general with your idea, but I am asking myself (and others) if this is too cryptic. Maybe we should use another argument for this...
The idea is the following. Semantic components provide some semantic to components defined in the URDF. (Currently is this only used on the controller side. See, for example, this line and this file). I imagine something similar on the hardware side. Especially, when using "standardized" interface names as in the linked constructor. So we would define semantic components something like: "Standard" 6D - FTS
non-standard (less than 6D FTS) (using the second constructor - parsing similar as in FTS Broadcaster)
Nevertheless, this is out of the scope of this PR. For this PR, I propose to only add |
I agree with Denis that the recent changes has gone a little beyond scope and are generally confusing. IMO the xml should not direct how exactly those strings are created, it should not be so tightly tied to how we implemented interfaces and their handling. I would recommend to only keep
from the proposals in this PR as everything else is out of scope. Let's discuss what's useful from the rest and how it is useful to incorporate another field instead of |
This works now, and the |
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 nit-picks only. Can also be merged without those.
hardware_interface/include/hardware_interface/hardware_info.hpp
Outdated
Show resolved
Hide resolved
Co-authored-by: Denis Štogl <[email protected]>
Co-authored-by: Denis Štogl <[email protected]>
Co-authored-by: Denis Štogl <[email protected]>
Adds support for non-joint components named
gpio
in the urdf, following the discussion from #318.The code can be tested with ros2_control_demos/with_gpio.
How to run
ros2 launch ros2_control_demo_robot rrbot_system_with_sensor_and_gpio.launch.py
ros2 control load_controller --set-state start forward_gpio_controller
Comments
The hardware demo has three GPIO inputs, one sensor, and one GPIO output. The GPIO inputs and sensor readings are affected by the GPIO output, but decay to zero on their own.
The
gpio
interfaces are basically the same as thejoint
interfaces, and the thought is that generalizations can be done using something like the semantic components to easily claim multiple GPIO interfaces.