Add simple transmission class#245
Conversation
transmission_interface/include/transmission_interface/simple_transmission.h
Outdated
Show resolved
Hide resolved
transmission_interface/include/transmission_interface/simple_transmission.h
Outdated
Show resolved
Hide resolved
|
@Karsten1987 @destogl this should fix one half of the failures we are getting from #236 , please let me know your feeling about this updated version. |
destogl
left a comment
There was a problem hiding this comment.
It doesn`t look bad. I am not happy with the used nomenclature, but I also do not have any better ideas.
I will check tests to be finished to approve it.
transmission_interface/include/transmission_interface/simple_transmission.h
Outdated
Show resolved
Hide resolved
transmission_interface/include/transmission_interface/simple_transmission.h
Outdated
Show resolved
Hide resolved
transmission_interface/include/transmission_interface/simple_transmission.h
Outdated
Show resolved
Hide resolved
Karsten1987
left a comment
There was a problem hiding this comment.
I don't see any changes here.
| target_include_directories(transmission_parser PUBLIC include) | ||
| ament_target_dependencies(transmission_parser hardware_interface tinyxml2_vendor TinyXML2) | ||
| ament_export_dependencies(hardware_interface tinyxml2_vendor TinyXML2) | ||
| ament_export_dependencies(transmission_parser tinyxml2_vendor TinyXML2) |
There was a problem hiding this comment.
consider moving this further down next to ament_export_include_directories
There was a problem hiding this comment.
I belive @Karsten1987 meant to move ament_export_dependencies to the end of the file
| #add_library(transmission_plugins SHARED | ||
| # include/transmission_interfrace/simple_transmission.h | ||
| #) | ||
| #target_include_directories(transmission_plugins PUBLIC include) | ||
| #ament_target_dependencies(transmission_plugins hardware_interface tinyxml2_vendor TinyXML2) | ||
| #ament_export_dependencies(transmission_plugins hardware_interface tinyxml2_vendor TinyXML2) | ||
| #target_compile_definitions(transmission_plugins PRIVATE "TRANSMISSION_INTERFACE_BUILDING_DLL") | ||
|
|
transmission_interface/include/transmission_interface/simple_transmission.h
Outdated
Show resolved
Hide resolved
| EXPECT_EQ(-1.0, trans.get_joint_offset()); | ||
| } | ||
|
|
||
| // #ifndef NDEBUG |
There was a problem hiding this comment.
what's up with these tests?
5d49a43 to
1931f10
Compare
|
|
||
| ActuatorHandle actuator_position = {"", "", nullptr}; | ||
| ActuatorHandle actuator_velocity = {"", "", nullptr}; | ||
| ActuatorHandle actuator_effort = {"", "", nullptr}; |
There was a problem hiding this comment.
Please end your member variables with a "_".
| const std::vector<ActuatorHandle> & actuator_handles) | ||
| { | ||
| // check that joint / act names are identical | ||
| // check that joint interfaces and actuator interfaces match |
There was a problem hiding this comment.
Also check the actual handle is valid: handle name and interface are not empty.
| } | ||
|
|
||
| // *jnt_data.absolute_position[0] = *act_data.absolute_position[0] / reduction_ + jnt_offset_; | ||
| // *jnt_data.torque_sensor[0] = *act_data.torque_sensor[0] * reduction_; |
There was a problem hiding this comment.
wasn't sure what to do with these
| inline void SimpleTransmission::joint_to_actuator() | ||
| { | ||
| if (joint_effort && actuator_effort) { | ||
| actuator_effort.set_value(joint_effort.get_value() / reduction_); |
There was a problem hiding this comment.
I know this was present in the original implementation, but I'm wondering in which cases should the reduction be applied to the effort interface. E.g., it does not make sense if you are using current as effort.
There was a problem hiding this comment.
What should we do here instead? Acceleration? Torque? same handling for both?
1931f10 to
4640a8e
Compare
4640a8e to
9b348db
Compare
9b348db to
baf4d1e
Compare
baf4d1e to
5135346
Compare
| /** | ||
| * \brief Transform \e effort variables from actuator to joint space. | ||
| * \param[in] act_data Actuator-space variables. | ||
| * \param[out] jnt_data Joint-space variables. | ||
| * \pre Actuator and joint effort vectors must have size 1 and point to valid data. | ||
| * To call this method it is not required that all other data vectors contain valid data, and can even remain empty. | ||
| */ | ||
| void actuator_to_joint() override; | ||
|
|
||
| /** | ||
| * \brief Transform \e effort variables from joint to actuator space. | ||
| * \param[in] jnt_data Joint-space variables. | ||
| * \param[out] act_data Actuator-space variables. | ||
| * \pre Actuator and joint effort vectors must have size 1 and point to valid data. | ||
| * To call this method it is not required that all other data vectors contain valid data, and can even remain empty. | ||
| */ | ||
| void joint_to_actuator() override; |
There was a problem hiding this comment.
It is a bit confusing that these methods have documented param[in] and param[out] args, but they have no params, I have to assume that they operate on the handles provided in the configure, maybe we should mention this explicitely.
| void configure( | ||
| const std::vector<JointHandle> & joint_handles, | ||
| const std::vector<ActuatorHandle> & actuator_handles) override; |
There was a problem hiding this comment.
We should document that it is expected that you can provide multiple Handles but only of different interfaces of the same joint. I did not understand it until I got to the implementation of this method.
There was a problem hiding this comment.
Can we check this somehow to protect users from making errors?
There was a problem hiding this comment.
@destogl it is checked and exceptions are thrown accurately reporting the issue. I'll add docs to reinforce
destogl
left a comment
There was a problem hiding this comment.
Sorr to be very picky. It seems there are some obsolete comments.
| target_include_directories(transmission_parser PUBLIC include) | ||
| ament_target_dependencies(transmission_parser hardware_interface tinyxml2_vendor TinyXML2) | ||
| ament_export_dependencies(hardware_interface tinyxml2_vendor TinyXML2) | ||
| ament_export_dependencies(transmission_parser tinyxml2_vendor TinyXML2) |
There was a problem hiding this comment.
I belive @Karsten1987 meant to move ament_export_dependencies to the end of the file
| void configure( | ||
| const std::vector<JointHandle> & joint_handles, | ||
| const std::vector<ActuatorHandle> & actuator_handles) override; |
There was a problem hiding this comment.
Can we check this somehow to protect users from making errors?
| * \pre Nonzero reduction value. | ||
| */ | ||
| SimpleTransmission( | ||
| const double reduction, |
There was a problem hiding this comment.
Disclaimer: I am not a transmission expert, but...
What does "Reduction ratio" means? Is this ratio "actuator/joint" or "joint/actuator". this should be at least documented.
I think a better variable name would be (if correct):
| const double reduction, | |
| const double actuator_to_joint_ratio, |
There was a problem hiding this comment.
There is plenty of this on the class documentation but I also renamed the argument. For brevity, the member variable name didn't change.
| * \param[in] act_data Actuator-space variables. | ||
| * \param[out] jnt_data Joint-space variables. |
There was a problem hiding this comment.
Nowhere, removed the offending doc
| : reduction_(reduction), | ||
| jnt_offset_(joint_offset) | ||
| { | ||
| if (0.0 == reduction_) { |
There was a problem hiding this comment.
This is rather an unusual syntax.
| if (0.0 == reduction_) { | |
| if (reduction_ == 0.0) { |
| * \param[in] act_data Actuator-space variables. | ||
| * \param[out] jnt_data Joint-space variables. |
There was a problem hiding this comment.
this is probably copied from earlier code?
| * \param[in] act_data Actuator-space variables. | |
| * \param[out] jnt_data Joint-space variables. |
| * \param[in] jnt_data Joint-space variables. | ||
| * \param[out] act_data Actuator-space variables. |
There was a problem hiding this comment.
this is probably copied from earlier code?
| * \param[in] jnt_data Joint-space variables. | |
| * \param[out] act_data Actuator-space variables. |
|
Thanks guys for the comments, I believe I should have addressed them all now. Let me know if there's anything else. |
* Remove compile warnings. * correct formatting.
This is me porting over SimpleTransmission from ROS1.
I haven't updated the documentation but it should be mostly relevant.
Updates licenses to Apache2 from original.
Question:
Should I add a JointInterface and an ActuatorInterface class to
transmission_interfacewhich transmissions can be used with?Should communicate clearly what "handle" is intended to be used where. If you have other suggestions, fire away.