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

Velocity interpolation and small changes #8

Merged
merged 15 commits into from
Mar 12, 2020

Conversation

marshallpowell97
Copy link
Contributor

Biggest change is using "velocity interpolation" to remove jerk at end of trajectories as described in #2

Small changes such as replacing magic numbers (#7) and check for VAL 3 version (#5)

Some edits to closer reflect official Staubli terminology

marshallpowell97 and others added 6 commits January 20, 2020 12:45
…ectory

If Val3 driver recieves default value from industrial_robot_client (0.1), it replaces it with new value interpolated from previous velocities. May slow down robot at the end of trajectory if incorrect max velocities/accelerations are used in arm URDF file.
Copy link
Member

@gavanderhoorn gavanderhoorn left a comment

Choose a reason for hiding this comment

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

Thanks for the PR 👍 very much appreciated.

Some minor comments and questions, with one or two things I believe should be changed.

Could you take a look at those?

And one additional comment: should velocity interpolation be done at a 'higher level'? Right now it's done in the message decoding functions, which doesn't seem like it would be the right place to do it: it's duplicated in both the traj pt files and it requires a bit of history, which I would expect to be handled at a higher level (of abstraction).

staubli_val3_driver/val3/ros_server/.outlining.json Outdated Show resolved Hide resolved
staubli_val3_driver/val3/ros_server/decTrajPt.pgx Outdated Show resolved Hide resolved
staubli_val3_driver/val3/ros_server/decTrajPtFull.pgx Outdated Show resolved Hide resolved
staubli_val3_driver/val3/ros_server/dataReceiver.pgx Outdated Show resolved Hide resolved
staubli_val3_driver/val3/ros_server/ros_server.dtx Outdated Show resolved Hide resolved
staubli_val3_driver/README.md Outdated Show resolved Hide resolved
staubli_val3_driver/val3/ros_server/start.pgx Show resolved Hide resolved
@gavanderhoorn
Copy link
Member

@gonzalocasas and @nilsmelchert: would you perhaps see any chance to test this PR?

@gonzalocasas
Copy link
Contributor

gonzalocasas commented Jan 21, 2020

Would it be possible to split this into two PRs, one for the velocity smoothing (which looks good on a quick glance), and a second one for the small changes?

EDIT:
Because I can easily test the smaller change of the velocity smoothing, but it would take me longer to test the larger (although simpler) change.

@gavanderhoorn
Copy link
Member

Tbh I'd rather not ask this of @marshallpowell97. He's already had to migrate his commits to this repository, after having worked on ros-industrial/staubli_experimental.

Could you perhaps cherry-pick the commits you'd be willing to test?

@gonzalocasas
Copy link
Contributor

Sure, I can do that.

@gavanderhoorn
Copy link
Member

@marshallpowell97: would you have a chance to take a look at the outstanding comments?

@gonzalocasas: have you had a chance to test the velocity/acceleration related changes?

re: cherry-picking: that won't work, as the repositories do not share a common ancestor, but you could see whether git apply can merge the relevant patches into your fork of ros-industrial/staubli_experimental.

@gavanderhoorn
Copy link
Member

@marshallpowell97: once #9 is merged, could you rebase your PR on top? So we have CI info on this PR as well.

@marshallpowell97
Copy link
Contributor Author

@gavanderhoorn just to make sure, should I go ahead and split this into 2 PRs?

@gavanderhoorn
Copy link
Member

@gavanderhoorn just to make sure, should I go ahead and split this into 2 PRs?

I don't believe that would be needed.

It won't make it really easier for others to test those changes, and we already have everything in separate commits.

@gavanderhoorn
Copy link
Member

To clarify: @marshallpowell97: in order to merge this PR we'd need to address some of my outstanding comments/questions (see the review comments).

Additionally it would be great if someone from the community (ie: @gonzalocasas or perhaps @nilsmelchert) could test it out.

@nilsmelchert
Copy link

If you tell me exactly what you want me to test, I'll be happy to do it.
What kind of trajectory should I use to show the improvement?

@gavanderhoorn
Copy link
Member

gavanderhoorn commented Feb 6, 2020

I would say any normal trajectory, as you would normally execute.

The idea of these changes is that they make regular use of the robots better, due to better processing of trajectories.

I'm expecting the changes @marshallpowell97 introduces here together with reducing joint velocity limits to the Nominal ones (#2) to significantly improve the (perceived) quality of trajectory execution.

@gonzalocasas
Copy link
Contributor

@gavanderhoorn I am testing this changes now, and I don't seen a big difference, so either I'm looking at the wrong trajectory, or the effect is rather small. I would agree with @nilsmelchert that a reference trajectory to test on would be of help.

@gavanderhoorn
Copy link
Member

Thanks for testing.

Have you also updated the velocity limits of your model(s) to the Nominal values, instead of the maximum ones?

I would expect the biggest differences at the end of the trajectory.

@gonzalocasas
Copy link
Contributor

Nope, I haven't. I'm running them with a minimal load (I haven't weighed it, but it's a very light end-effector that is not picking up anything), and if I understand correctly, that fits right in the definition of what "max" is for according to #2 (comment)

@gonzalocasas
Copy link
Contributor

I tested a bit more, with a larger set of trajectories; and I think I saw the effect at the end of some. Not a very scientific observation thou ;)

@marshallpowell97
Copy link
Contributor Author

Back on this after being MIA. @gonzalocasas The only difference that you should notice is at the very end of the trajectory. When using the maximum joint velocity limits, there is a "spike" in velocity on the very last point sent. It seems to be that the default velocity for industrial_robot_client is 0.1 when the planned velocity (for the last waypoint) is 0 (I'm not super familiar with the terminology, please correct me if I'm wrong).
image
Per #2, if you use the nominal values for the joint velocity limits, it doesn't seem to have much of an effect (if any), because the robot will have reached its destination by the time the last waypoint is received.

Co-Authored-By: G.A. vd. Hoorn <g.a.vanderhoorn@tudelft.nl>
Change from indexing through array (nMsgState) to having individual variables as "constants"
Added `interpolateVel` program, called as a part of `pushMotion`
@marshallpowell97
Copy link
Contributor Author

To give an example of the effect of the 'velocity interpolation', I took recordings of the trajectory with and without it enabled:

Disabled:
image

Enabled:
image

This was done with a "real-time" simulation, so it won't be exactly the same as a real robot, but it should get the idea across.

@gavanderhoorn
Copy link
Member

@marshallpowell97: it'd be really great if we could move the velocity averaging to a more appropriate place, as that is about the only thing keeping this PR from being merged.

@marshallpowell97
Copy link
Contributor Author

@gavanderhoorn anything else that needs to be fixed before merging?

gavanderhoorn
gavanderhoorn previously approved these changes Mar 12, 2020
Copy link
Member

@gavanderhoorn gavanderhoorn left a comment

Choose a reason for hiding this comment

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

I've pushed a few minor fixup commits. @marshallpowell97: if you could verify everything still works (I don't have easy access to SRS here).

Also added a single in-line comment, and I'll open some issues to track remaining issues.

If/when you confirm the VAL 3 application still works @marshallpowell97, we can merge.

Big thanks for the improvements here 👍 your contributions are very much appreciated.

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://www.staubli.com/robotics/VAL3/Project/3">
<Parameters version="s7.7.2" stackSize="5000" millimeterUnit="true" />
<Parameters version="s7.11" stackSize="5000" millimeterUnit="true" />
Copy link
Member

Choose a reason for hiding this comment

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

Does this affect compatibility with older OS versions in any way?

@marshallpowell97
Copy link
Contributor Author

marshallpowell97 commented Mar 12, 2020

Hold on, I may have done this wrong. @gavanderhoorn Did I need to make a new commit or 'review changes' on the previous one? My apologies, still learning Git...

@gavanderhoorn
Copy link
Member

Hold on, I may have done this wrong. @gavanderhoorn Did I need to make a new commit or 'review changes' on the previous one?

To fix the identifier length limit problem you needed to commit. With the way the repository is configured right now, this leads to you dismissing the review. That was expected.

As this is your own PR, you cannot review it.

@marshallpowell97
Copy link
Contributor Author

@marshallpowell97: if you could verify everything still works (I don't have easy access to SRS here).

I can confirm that this does still work.

image

@gavanderhoorn gavanderhoorn merged commit eb06ab2 into ros-industrial:master Mar 12, 2020
@gavanderhoorn
Copy link
Member

GH merge button was set to rebase and merge, instead of regular merge.

Manually fixed this by force-pushing to master.

@gavanderhoorn
Copy link
Member

Thanks for iterating @marshallpowell97 👍

and thanks again for the PR.

x_mMotion.mDesc.vel = x_mMotion.mDesc.vel / 10000
// Smooth last point in traj
if((x_mMotion.mDesc.vel == 0.1) and (x_mMotion.nSequence != 0))
x_mMotion.mDesc.vel = (nVel[0] - (nVel[1] - nVel[0]))
Copy link
Contributor

Choose a reason for hiding this comment

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

@gavanderhoorn @marshallpowell97: Couldn't this end up in a negative velocity if nVel[0] == 0.0? And if so, what would the controller do? Would it skip the point completely?

I am asking because I see a concrete problem on our setup: after I cherry picked this change to my private fork (*) I started noticing that the very last point of some trajectories is never reached, at all. I am not sure this change causes it, however, it is the main suspect at the moment.

(*disclaimer: my fork is not identical, however, the joint trajectory execution part should be untouched and matching what you have here)

Copy link
Member

Choose a reason for hiding this comment

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

Technically it could become negative.

In practive however, iirc, 0 velocities are not used by the nodes in the IRC. Are you using a custom client as well?

Copy link
Member

Choose a reason for hiding this comment

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

@marshallpowell97: could you comment on what the controller would do in that case?

Copy link
Contributor

Choose a reason for hiding this comment

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

Are you using a custom client as well?

I am using the industrial robot client (IRC) with the modifications for cartesian trajectories I showed you long ago. In principle, I haven't changed anything on the joint trajectory handling thou, and we've been used this modified IRC client for many months and this behavior only started occurring recently. After going through changes applied to the setup, this stands out as the most likely candidate, however, I cannot 100% rule out something else.

Copy link
Member

Choose a reason for hiding this comment

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

Well, I'm not claiming the code is faultless. Could you perhaps share a .bag/wireshark capture of a trajectory which exhibits the problem you're encountering?

Copy link
Member

Choose a reason for hiding this comment

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

This is not really a format @marshallpowell97 can directly use.

@gonzalocasas: it would be very much appreciated if you could convert this into something like this. That would make reproduction much easier.

Copy link
Member

Choose a reason for hiding this comment

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

I would also suggest to post both a .bag (with the trajectory topics as well as /joint_states) and a wireshark capture, so we have both the ROS side and the Simple Message side and can compare.

Copy link
Member

Choose a reason for hiding this comment

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

Finally: let's open a new issue, as a comment on a already merged PR is not very well suited for this.

Copy link
Contributor

Choose a reason for hiding this comment

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

I added the rosbag file to the gist (https://gist.github.com/gonzalocasas/a52a63b579d8a1d8fc4ad983a319b39d#file-unfinished-trajectory_2020-03-20-14-57-09-bag). The robot is namespaced under /microphone/. The trajectory is sent directly to the service interface (joint_path_command) so I guess it does not show up in this bag file.

Copy link
Contributor

Choose a reason for hiding this comment

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

Finally: let's open a new issue, as a comment on a already merged PR is not very well suited for this.

Agree! Just created a new issue here #16 (I started off as comment, because I am unsure about the source of this, but now it is long enough to be an issue on its own)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Strange accel override
4 participants