Skip to content

Add component parser#122

Closed
destogl wants to merge 4 commits intoros-controls:masterfrom
destogl:component_parser
Closed

Add component parser#122
destogl wants to merge 4 commits intoros-controls:masterfrom
destogl:component_parser

Conversation

@destogl
Copy link
Copy Markdown
Member

@destogl destogl commented Jul 15, 2020

the second part of #101

Depends on #121

@Karsten1987
Copy link
Copy Markdown
Contributor

Can this PR be targeted against the branch of #121? Then the diff is somewhat easier to read.

Copy link
Copy Markdown
Contributor

@Karsten1987 Karsten1987 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate on what hardware means to you here? I am missing the definition of system in here as there's a SystemInfo struct.

Comment on lines +155 to +157
<actuator name="motor1">
<mechanicalReduction>1</mechanicalReduction>
</actuator>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I though we're treating only joints and no actuators? It's up to the implementation of the joint to deal with actuators.
The mechanicalReducation could then be placed within a transmission tag inside the joint.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's up to the implementation of the joint to deal with actuators.

No.

As we discussed multiple times now, the joint to actuator relationship is not one to one. Transmissions cannot be completely handled by joints, they are a separate entity, not handled by either actuators or joints but some Hardware Abstraction Layer (whatever we call that now).

That being said, I think that these examples can probably omit transmissions and only define what the components require.


urdf_xml_tail_ =
R"(
<transmission name="tran1">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is the transmission the top tag here?

Comment on lines +174 to +178
<hardware>
<classType>ros2_control_demo_hardware/DemoRobotHardwareMinimal</classType>
<param name="write_for_sec">2</param>
<param name="read_for_sec">2</param>
</hardware>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is hardware here? And what is write_for_sec and read_for_sec? Where is this being used?


valid_urdf_ros2_control_joints_only_ =
R"(
<ros2_control name="MinimalRobot" type="robot">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what other types than robot can be there?

if (!ros2_control_it) {
throw std::runtime_error("no " + std::string(kROS2ControlTag) + " tag");
}
attr = ros2_control_it->FindAttribute("name");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this section could be made more readable if you had a helper function that's something along these lines:

string get_attr_value(const tinyxml2::XMLElement * some_it, string attribute_name)
{
const tinyxml2::XMLAttribute * attr;
attr = some_it->FindAttribute(attribute_name);
  if (!attr) {
    throw std::runtime_error("no attribute name in " + attribute_name + " tag");
  }
return some_it->Attribute(attribute_name);
}

then you can simplify this parsing bit to:

// shorter version of getting the attribute value
  system.type = get_attr_value(ros2_control_it, "type");

I'm not sure this applies to all cases but it seems like a fair bit could use it

Comment on lines +155 to +157
<actuator name="motor1">
<mechanicalReduction>1</mechanicalReduction>
</actuator>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's up to the implementation of the joint to deal with actuators.

No.

As we discussed multiple times now, the joint to actuator relationship is not one to one. Transmissions cannot be completely handled by joints, they are a separate entity, not handled by either actuators or joints but some Hardware Abstraction Layer (whatever we call that now).

That being said, I think that these examples can probably omit transmissions and only define what the components require.

<joint name="joint1">
<interfaceName>position</interfaceName>
</joint>
<param name="can_read">True</param>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is can_read in this context?

Comment on lines +58 to +60
HARDWARE_INTERFACE_PUBLIC
virtual
return_type read(std::vector<double> & data) = 0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as mentioned yesterday, it is not really clear to me what read does here. Imagine I have a robot with an integrated sensor. First off, how do I know which sensor to address here and their size of data? You can imagine that different sensors have different types of data to return.


return_type
virtual
write(const std::vector<double> & data) = 0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this vector data comes from the resource manager? Or which entity is allocating the memory for the data?

destogl added a commit to destogl/ros2_control that referenced this pull request Aug 17, 2020
@destogl
Copy link
Copy Markdown
Member Author

destogl commented Aug 17, 2020

I hope we clarified all the comments here in the discussion on ros-controls/roadmap#22

I am closing this in favor of #127 so that we do not have a dependency on #121.

@destogl destogl closed this Aug 17, 2020
@destogl destogl deleted the component_parser branch August 17, 2020 15:39
destogl added a commit to destogl/ros2_control that referenced this pull request Aug 19, 2020
destogl added a commit to destogl/ros2_control that referenced this pull request Aug 20, 2020
bmagyar pushed a commit that referenced this pull request Sep 8, 2020
* Added new version of parser. Files checkout from #122
* SensorHardware can handle multiple sensor types
destogl added a commit to b-robotized-forks/ros2_control that referenced this pull request Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants