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

Add FixedOrientation (Omni) and Sideward orientation modes #89

Merged
merged 7 commits into from
Nov 8, 2023

Conversation

renan028
Copy link
Member

@renan028 renan028 commented Nov 6, 2023

Description

wrike: https://www.wrike.com/open.htm?id=1243708620
In Taisei project, customer requires Takumi robot to prefer to move sideways after picking the payload.
It is safer to move sideways after picking, because robot grows a lot in y-axis (image below). It is safer to move in the direction of the minimal sweep for collision avoidance.

There are different ways to address that:

  1. Rotate the base_link frame; or velocities / odom, etc
  2. Change the GlobalPlanner to generate the correct path
  3. Tune TEB
    The (1) solution is a bit hacky and I think it would cause some issues. Since everything (perception, localization and navigation nodes) relies in base_link frame, changing it dynamically seems dangerous. And rotating the velocities may cause other issues too.
    The (3) seems to be the easiest one, but it did not work as expected (as explained below).
    The (2) solution was implemented.

image

We attempted to change TEB to prefer moving sideways without changing global planner:

  1. global_plan_overwrite_orientation to True so TEB can choose the best orientation for minimal time
  2. max_vel_x to 0.06 and max_vel_y to 0.5 so that vel_y is chosen
    However, TEB does not rotate the robot and moves sideways. It continues to move forwards/backward in a very small speed.

After changing the GlobalPlanner logic by adding a new mode (LeftRightWard), TEB manages to use the correct orientation.

leftrightward-2023-11-06_13.09.05.mp4

@renan028 renan028 added the enhancement New feature or request label Nov 6, 2023
@renan028 renan028 requested a review from a team November 6, 2023 04:33
global_planner/cfg/GlobalPlanner.cfg Outdated Show resolved Hide resolved
global_planner/src/orientation_filter.cpp Outdated Show resolved Hide resolved
@siferati siferati requested a review from a team November 6, 2023 05:07
global_planner/cfg/GlobalPlanner.cfg Outdated Show resolved Hide resolved
global_planner/src/orientation_filter.cpp Outdated Show resolved Hide resolved
global_planner/src/orientation_filter.cpp Outdated Show resolved Hide resolved
global_planner/src/orientation_filter.cpp Outdated Show resolved Hide resolved
Comment on lines 113 to 114
std::fabs(angles::normalize_angle(rotation_to_path - M_PI_2)) + std::fabs(angles::normalize_angle(rotation_to_goal - M_PI_2)) <
std::fabs(angles::normalize_angle(rotation_to_path + M_PI_2)) + std::fabs(angles::normalize_angle(rotation_to_goal + M_PI_2));

Choose a reason for hiding this comment

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

F: I think the second time, the sign of the half rotation needs to be inverted, no? I.e.

Suggested change
std::fabs(angles::normalize_angle(rotation_to_path - M_PI_2)) + std::fabs(angles::normalize_angle(rotation_to_goal - M_PI_2)) <
std::fabs(angles::normalize_angle(rotation_to_path + M_PI_2)) + std::fabs(angles::normalize_angle(rotation_to_goal + M_PI_2));
std::fabs(angles::normalize_angle(rotation_to_path - M_PI_2)) + std::fabs(angles::normalize_angle(rotation_to_goal + M_PI_2)) <
std::fabs(angles::normalize_angle(rotation_to_path + M_PI_2)) + std::fabs(angles::normalize_angle(rotation_to_goal - M_PI_2));

Copy link
Member Author

Choose a reason for hiding this comment

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

It should be inverted, that is correct, thanks. The robot will need to undo the rotation.

image

Choose a reason for hiding this comment

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

nice picture. Is that the plot of

std::fabs(angles::normalize_angle(rotation_to_path - M_PI_2)) + std::fabs(angles::normalize_angle(rotation_to_goal + M_PI_2)) < 
std::fabs(angles::normalize_angle(rotation_to_path + M_PI_2)) + std::fabs(angles::normalize_angle(rotation_to_goal - M_PI_2));

I suppose? Is there some intuitive way to see that this is indeed the correct result?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes. that is the plot of the function:

std::fabs(angles::normalize_angle(rotation_to_path - M_PI_2)) + std::fabs(angles::normalize_angle(rotation_to_goal + M_PI_2)) < 
std::fabs(angles::normalize_angle(rotation_to_path + M_PI_2)) + std::fabs(angles::normalize_angle(rotation_to_goal - M_PI_2));

hm, I think the best way to understand is by visualizing the start/goal in circle quadrant:

image

The cases we want leftward/rightward (figures on the left), we can see that the solution is the correct one.
The other cases (when we switch orientation by a lot) it doesn't matter much which one we should choose since the "cost" is basically the same (for both leftward or rightward), and that is why we have this "frog" graph.
My concern is with the switching part, which can lead to some oscillation, maybe

@renan028 renan028 force-pushed the rs/omni_orientation branch from 0017323 to 011d0c4 Compare November 6, 2023 06:09
@renan028 renan028 changed the title Add Omni and Left/Right Ward Add FixedOrientation (Omni) and Sideward planners Nov 7, 2023
@renan028 renan028 changed the title Add FixedOrientation (Omni) and Sideward planners Add FixedOrientation (Omni) and Sideward orientation modes Nov 7, 2023
global_planner/src/orientation_filter.cpp Outdated Show resolved Hide resolved
@renan028 renan028 merged commit 6239527 into devel Nov 8, 2023
1 check passed
@renan028 renan028 deleted the rs/omni_orientation branch November 8, 2023 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants