Skip to content
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 joint_limits_interface - Direct port from ROS 1 #135

Closed

Conversation

ahcorde
Copy link
Contributor

@ahcorde ahcorde commented Aug 27, 2020

As discussed yesterday in the ros2_control WG, I'm adding this package originally ported by @ddengster

I still need to copy from @ddengster repository the transmmision_interface package.

@Karsten1987 @bmagyar

Co-authored-by: ddengster [email protected]

Signed-off-by: ahcorde [email protected]

@codecov-commenter
Copy link

codecov-commenter commented Aug 27, 2020

Codecov Report

Merging #135 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #135   +/-   ##
=======================================
  Coverage   43.54%   43.54%           
=======================================
  Files          42       42           
  Lines        1410     1410           
  Branches      761      761           
=======================================
  Hits          614      614           
  Misses        112      112           
  Partials      684      684           
Flag Coverage Δ
#unittests 43.54% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b9ea092...e05d0da. Read the comment docs.

@bmagyar
Copy link
Member

bmagyar commented Aug 28, 2020

@v-lopez @jordan-palacios could you guys confirm whether the license on this could also be updated?

@v-lopez
Copy link
Contributor

v-lopez commented Aug 28, 2020

Yes, no problem.

Copy link
Contributor

@v-lopez v-lopez left a comment

Choose a reason for hiding this comment

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

I'd cleanup the test part before merging. Also made some minor suggestions.

@ahcorde
Copy link
Contributor Author

ahcorde commented Sep 3, 2020

Sorry for the bad conditions of the package. I was just copying a version from other repo that it was just functional.

I added

  • common ROS 2 linters
  • Fixed test

@ahcorde ahcorde requested a review from v-lopez September 3, 2020 12:31
Copy link
Member

@destogl destogl left a comment

Choose a reason for hiding this comment

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

First part of the review.

double max_vel_limit_;
};

#if 0
Copy link
Member

Choose a reason for hiding this comment

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

It seems this code is never used. Do we still need it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added a TODO

Copy link
Member

@destogl destogl left a comment

Choose a reason for hiding this comment

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

Also remove .pyc file.

I have to do it one more time

@@ -0,0 +1,39 @@
<package format="2">
Copy link
Member

Choose a reason for hiding this comment

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

Why not use format=3

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The other packages are version 2, I can update this one.


<maintainer email="[email protected]">Bence Magyar</maintainer>
<maintainer email="[email protected]">Enrique Fernandez</maintainer>
<maintainer email="[email protected]">Mathias Lüdtke</maintainer>
Copy link
Member

Choose a reason for hiding this comment

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

Add not-active maintainers as authors

Copy link
Contributor Author

Choose a reason for hiding this comment

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

can you suggest me which are the authors and maintainer of this package?

Copy link
Member

Choose a reason for hiding this comment

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

I think Enrique and Mathias are not active so much here, so I would move them in authors. @bmagyar is clearly maintainer :)

@destogl
Copy link
Member

destogl commented Sep 9, 2020

This looks good to me. I believe using the new concept from #121 this code is only temporarily. If not so there are few more issues. I list them here just for the "documentation":

Signed-off-by: ahcorde <[email protected]>
Signed-off-by: ahcorde <[email protected]>
@ahcorde ahcorde requested a review from destogl September 15, 2020 13:46
Copy link
Member

@destogl destogl left a comment

Choose a reason for hiding this comment

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

It looks good!

// Copyright 2013, PAL Robotics S.L. All rights reserved.
// All rights reserved.
//
// Software License Agreement (BSD License 2.0)
Copy link
Member

@destogl destogl Sep 20, 2020

Choose a reason for hiding this comment

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

Is this potential issue in the ros2_control repository? Currently, we have everything Apache2.0 licensed. If so, can we discuss this with PAL to change the license?

@bmagyar can you please take a look?

Copy link
Contributor

Choose a reason for hiding this comment

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

If it is a problem we have no objections to change it to Apache2.0

Copy link
Member

Choose a reason for hiding this comment

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

@guru-florida
Copy link
Contributor

Unfortunately it looks like this merge didn't make it in time before the use of the new JointHandle from #134 took place (see also #155). I will see if I can resolve.

@guru-florida
Copy link
Contributor

ok, I have a build working with the use of the new JointHandle (#134). I have also fixed up the tests and they are all passing. You can see my changes in:
https://github.com/guru-florida/ros2_control/tree/ahcorde/add/joint_limit_interface/joint_limits_interface

Should I create a new PR?

Here is my review of the code. Most of the code is in the following joint limit policies:

  • PositionJointSaturationHandle
  • PositionJointSoftLimitsHandle
  • EffortJointSaturationHandle
  • EffortJointSoftLimitsHandle
  • VelocityJointSaturationHandle
  • VelocityJointSoftLimitsHandle

There is also JointLimitsInterface<> that deals with creating these handles via ResourceManager that still needs porting to ROS2. I dont see any ResourceManager class so I think this is blocked on #164 and/or #141.

Refactoring: Much of the LimitHandle classes are identical except for the enforceLimits() method. I refactored that common code out into JointSaturationLimitHandle. It's constructor takes joint position state and command handle and a JointLimits object, same as all the saturation limit policies did before. I then derived JointSoftLimitsHandle from the JointSaturationLimitHandle which just adds the SoftJointLimits argument to the constructor. All the policies then derive from one of these base classes and override the pure virtual enforceLimits(...) method. There is some common handling of state and derived velocity as well. This simplified the code a lot and made fixing up easier. These 2 bases classes are at the top of the file.

Velocity Handle: The new generalized JointHandle no longer has a get_velocity() method, instead the user should construct a position and velocity handle separately. Therefor another constructor prototype was added that supports passing in position, velocity and command handles. If a velocity handle is not provided then velocity will be computed by position/time (saved previous state). User has a choice of estimating velocity by position deltas or using actual velocity via (ex) a speedometer.

Open/Closed Loop: @bmagyar Since state and command handles now have the same interface (under change #134), in fact the new state/command handle arguments are of identical type now....so do we have an opportunity to convert these limit interfaces to support open or closed loop? Since the state handle could be either the position state or a position command handle. Currently the enforceLimits() initially takes from the state handle, but then there-after it compares to previous command and generates a new constrained command. I am not sure I agree with "start with a state value then switch to command value" logic but I am hesitant to change any logic since I am a ros_controls newbie. Plus this is limits, not PID/control logic or something so I may be way off base....thoughts? Did #134 present an opportunity for new behavior? If so, I can probably code it easily into the 2 common base classes above.

@destogl
Copy link
Member

destogl commented Oct 2, 2020

@ahcorde can we close this PR an open the new one wir changes from @guru-florida?

@guru-florida the changes in #134 are also kind of temporary since we will move everything to components in the future (when ResourceManager is finished - #164 and #147). Nevertheless, this restructuring you did is anyway needed since the logic behind is similar.

Maybe you have some idea how to integrate the limits into components. The example implementation of the PositionJoint is in #140

@guru-florida
Copy link
Contributor

Thanks @destogl. I have created a new PR181.

@bmagyar
Copy link
Member

bmagyar commented Oct 5, 2020

Closing in favour of #181

@ahcorde ahcorde closed this Oct 6, 2020
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.

6 participants