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

Prevent JTAS Error with few Points #55

Merged
merged 4 commits into from
Apr 15, 2015

Conversation

rethink-imcmahon
Copy link
Contributor

This is a rebase and modification of PR #54 for release-1.1.1
where the JTAS would error out if too few points were passed into it.
This fixes a bug in the Bezier library which did not properly check for
two points.

@aginika, could you please take a look at this modified pull request?

aginika and others added 2 commits April 13, 2015 17:11
This commit partially resolves baxter_interface issue (#53 and #54),
where the JTAS would error out if too few points were passed into it.

There was a bug in the Bezier library which did not properly check for
two points, which this resolves. We can safely remove the additional
two point check in the joint trajectory action server based on this.

Trac ticket #11669
@rethink-imcmahon rethink-imcmahon changed the title Add trajectory points when few points Prevent JTAS Error with few Points Apr 13, 2015
@aginika
Copy link
Contributor

aginika commented Apr 14, 2015

@rethink-imcmahon Thanks! LGTM!

@rethink-imcmahon
Copy link
Contributor Author

I've created a gist to test this Issue / Pull Request:
https://gist.github.com/rethink-imcmahon/0affaf2767476b17f73f

<script src="https://gist.github.com/rethink-imcmahon/0affaf2767476b17f73f.js"></script>
# This script is meant to how the JTAS handles various numbers of points
# It executes a set of trajectories with 4 waypoints, then 3, then 2, then 1 waypoints.
# To run it, start with one baxter.sh sourced terminal
$ rosrun baxter_tools enable_robot.py -e
$ rosrun baxter_interface joint_trajectory_action_server.py --mode velocity
# another sourced terminal
$ ./test_joint_trajectory_client.py -l <left/right>

@aginika
Copy link
Contributor

aginika commented Apr 14, 2015

Amazing!
I will test with it.

@rethink-imcmahon
Copy link
Contributor Author

I decided to add some simple error checking around the Bezier computation, since regardless of whether the library has an error, the JTAS shouldn't die. I do want any error to propegate upward, so the error is passed through rospy.logerr to be seen by the user.

if dimensions_dict['accelerations']:
first_trajectory_point.accelerations = [0.0] * len(joint_names)
first_trajectory_point.time_from_start = rospy.Duration(0)
trajectory_points.insert( 0, first_trajectory_point )
Copy link
Member

Choose a reason for hiding this comment

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

no spaces around arguments

@rethink-rlinsalata
Copy link
Member

I honestly don't really understand the math bezier bits to know if your indexing and all is correct, but the rest looks fine (with maybe a slight confusion/redundancy on the velocities / accelerations bit as mentioned).

@rethink-rlinsalata
Copy link
Member

a.k.a. good to merge if you've tested it well

The if only one trajectory point is provided to the Joint Trajectory
Action Server, it technically does not count as a valid trajectory.
However, we attempt to make do by using the current position as the
first point in the trajectory. The second (and only point) is then
the provided trajectory pose.

The JTAS zeros out both velocities and accelerations for the final
position, since it assumes each trajectory ends with a stopped motion.
To prevent loss of data, in the case of only 1 trajectory point being
provided, this commit copies out the only point's velocities and
accelerations into the created initial point consisting of the current
joint positions. Having only one trajectory point is an edge case,
but one we would like to handle in a logical manner.
rethink-imcmahon pushed a commit that referenced this pull request Apr 15, 2015
…n-few-points

Prevent JTAS Error with few Points
@rethink-imcmahon rethink-imcmahon merged commit ab4af6a into release-1.1.1 Apr 15, 2015
@rethink-imcmahon rethink-imcmahon deleted the add-trajectory-points-when-few-points branch April 16, 2015 13:58
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.

4 participants