Skip to content

JointTrajectory: Don't use shortest_angular_distance for linear joints#623

Open
bmagyar wants to merge 1 commit into
noetic-develfrom
backport-lin-joint-fix
Open

JointTrajectory: Don't use shortest_angular_distance for linear joints#623
bmagyar wants to merge 1 commit into
noetic-develfrom
backport-lin-joint-fix

Conversation

@bmagyar

@bmagyar bmagyar commented Nov 13, 2023

Copy link
Copy Markdown
Member

Fixes #432

Port #591 to Noetic

@bmagyar

bmagyar commented Nov 13, 2023

Copy link
Copy Markdown
Member Author

@steinmn could you please nod in agreement? ;)

@steinmn steinmn left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nod :)

@steinmn steinmn left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

On second thought, something doesn't look quite right here

Comment on lines +786 to 797
if (is_linear_[joint_index])
{
state_joint_error_.position[0] = desired_joint_state_.position[0] - current_state_.position[joint_index];
}
else
{
state_joint_error_.position[0] = angles::shortest_angular_distance(current_state_.position[joint_index],desired_joint_state_.position[0]);
}
state_joint_error_.velocity[0] = desired_joint_state_.velocity[0] - current_state_.velocity[joint_index];
state_joint_error_.acceleration[0] = 0.0;

state_error_.position[joint_index] = angles::shortest_angular_distance(current_state_.position[joint_index],desired_joint_state_.position[0]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
if (is_linear_[joint_index])
{
state_joint_error_.position[0] = desired_joint_state_.position[0] - current_state_.position[joint_index];
}
else
{
state_joint_error_.position[0] = angles::shortest_angular_distance(current_state_.position[joint_index],desired_joint_state_.position[0]);
}
state_joint_error_.velocity[0] = desired_joint_state_.velocity[0] - current_state_.velocity[joint_index];
state_joint_error_.acceleration[0] = 0.0;
state_error_.position[joint_index] = angles::shortest_angular_distance(current_state_.position[joint_index],desired_joint_state_.position[0]);
if (is_linear_[joint_index])
{
state_error_.position[joint_index] = desired_joint_state_.position[0] - current_state_.position[joint_index];
}
else
{
state_error_.position[joint_index] = angles::shortest_angular_distance(current_state_.position[joint_index],desired_joint_state_.position[0]);
}

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.

Does JointTrajectoryController assume that joints are rotational?

2 participants