-
Notifications
You must be signed in to change notification settings - Fork 525
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
TrajectoryController: Use desired state to calculate hold trajectory #297
Merged
mathias-luedtke
merged 5 commits into
ros-controls:kinetic-devel
from
PilzDE:fix/jerk_on_stop
Mar 16, 2018
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e53b364
Use desired state to calculate hold trajectory
agutenkunst 9bc9fe7
add test case that fails without e53b364
jschleicher e0d7bee
add test case with upper bound (simulating a wall)
jschleicher e717d26
preserve jump, if stop_trajectory_duration==0
jschleicher 7a47b0b
incorporate review comments
jschleicher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,6 +138,13 @@ starting(const ros::Time& time) | |
time_data.uptime = ros::Time(0.0); | ||
time_data_.initRT(time_data); | ||
|
||
// Initialize the desired_state with the current state on startup | ||
for (unsigned int i = 0; i < joints_.size(); ++i) | ||
{ | ||
desired_state_.position[i] = joints_[i].getPosition(); | ||
desired_state_.velocity[i] = joints_[i].getVelocity(); | ||
} | ||
|
||
// Hold current position | ||
setHoldPosition(time_data.uptime); | ||
|
||
|
@@ -755,12 +762,14 @@ setHoldPosition(const ros::Time& time, RealtimeGoalHandlePtr gh) | |
const unsigned int n_joints = joints_.size(); | ||
for (unsigned int i = 0; i < n_joints; ++i) | ||
{ | ||
hold_start_state_.position[0] = joints_[i].getPosition(); | ||
hold_start_state_.velocity[0] = joints_[i].getVelocity(); | ||
// If there is a time delay in the system it is better to use calculate the hold trajectory starting from the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "better to use calculate the hold trajectory" |
||
// desired position. Otherwise there would be a jerk in the motion. | ||
hold_start_state_.position[0] = desired_state_.position[i]; | ||
hold_start_state_.velocity[0] = desired_state_.velocity[i]; | ||
hold_start_state_.acceleration[0] = 0.0; | ||
|
||
hold_end_state_.position[0] = joints_[i].getPosition(); | ||
hold_end_state_.velocity[0] = -joints_[i].getVelocity(); | ||
hold_end_state_.position[0] = desired_state_.position[i]; | ||
hold_end_state_.velocity[0] = -desired_state_.velocity[i]; | ||
hold_end_state_.acceleration[0] = 0.0; | ||
|
||
(*hold_trajectory_ptr_)[i].front().init(start_time, hold_start_state_, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,5 @@ rrbot_controller: | |
joint2: | ||
goal: 0.01 | ||
trajectory: 0.05 | ||
stop_trajectory_duration: 0.1 | ||
state_publish_rate: 100 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not change the behavior, it gets overwritten in
update
anyway.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exactly: It gets overwritten on the next update(). But
starting
callssetHoldPosition
three lines later and reads the desired_state (ifstop_trajectory_duration_ != 0
), so we have to initialize it beforehand.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I have just written this for clarification/justfication during the review :)