-
Notifications
You must be signed in to change notification settings - Fork 166
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
Yaw in flat target.msg #189
Yaw in flat target.msg #189
Conversation
…nter of the circle
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.
Thanks for the contribution!
All looks good except some minor points
- I think we need to add the case where yaw can be ignored. Could you add this case to the message definition and handle it in the callback?
- The polynomial trajectory is now set to yaw=0. I think this is a unnecessary restriction and basically disables the case for velocity yaw
- How does
velocity_yaw
option work with this case?
As far as I am concerned this does not add the reduced attitude controller for yaw control. From the discussion we had in #186 Are you planning to add this?
.gitignore
Outdated
@@ -5,3 +5,6 @@ | |||
|
|||
#Artifacts from vscode | |||
.vscode/* | |||
|
|||
#Rviz config | |||
geometric_controller/launch/config_file.rviz |
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.
Why would you want to ignore the rviz config?
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.
Because i am always configuring rviz. So need always to commit. I can remove this condition on .gitignore if you like.
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.
Please remove it from the gitignore. You just need to not commit the rviz changes you did when you commit
@@ -147,6 +147,7 @@ void geometricCtrl::flattargetCallback(const controller_msgs::FlatTarget &msg) { | |||
|
|||
targetPos_ = toEigen(msg.position); | |||
targetVel_ = toEigen(msg.velocity); | |||
mavYaw_ = double(msg.yaw.data); |
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 means that we always need to define yaw, which I think is not what we want. Can you add a case where we can specify ignoring yaw option and handle the case here?
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.
You are right. We can solve this by using a mask (IGNORE_YAW) in the message definition. What do you think?
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.
That sounds great
@@ -128,6 +128,10 @@ Eigen::VectorXd polynomialtrajectory::getCoefficients(int dim) { | |||
} | |||
} | |||
|
|||
float polynomialtrajectory::getYaw(double time) { | |||
float yaw = 0.0; |
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.
Where does yaw=0.0
come from? This needs to configurable, and probably belongs to the ignore yaw case
What do you mean? Using the already defined mask? something like IGNORE_MASK = some number?
Great question, i still have to think more about this.
Yes, it doesn't add, i am currently working on it. |
Yes, preferably a bitmask
Awesome! |
@brunopinto900 Any updates? |
@brunopinto900 Have you made any progress here? |
Hey, not yet. I am going on a vacation and have to finnish work stuff. |
@brunopinto900 Any updates regarding this work? |
Hello, Not yet. Since i am going a vacation, i am finnishing work stuff. By the way i sent you an e-mail. |
@brunopinto900 Since this PR has been open for almost a month, could you provide an approximate ETA on when this will be addressed? |
Since its a small thing, i can finnish tomorrow. |
@brunopinto900 Great, thanks |
I think we need to add the case where yaw can be ignored. Could you add this case to the message definition and handle it in the callback? This means that we always need to define yaw, which I think is not what we want. Can you add a case where we can specify ignoring yaw option and handle the case here? |
@brunopinto900 You can define a ignore flag as in https://github.com/mavlink/mavros/blob/29db67693a3fecadfec973a6879930645c2ee9d1/mavros_msgs/msg/AttitudeTarget.msg#L9 |
I added "std::msgs/bool IGNORE_YAW" in the message definition? Much simpler than a bit mask. What do you think? Or want to have as the AttitudeTarget.msg?
The polynomial trajectory now sets yaw to the direction of drone [ atan2f(velocity(1),velocity(0)); ]. But already added logic to ignore yaw.
Removed rviz from .gitignore I have two questions. Shouldn't mavYaw_ be targetYaw_? Because its the target orientation and not the current drone yaw
Eigen::Vector3d geometricCtrl::controlPosition(const Eigen::Vector3d &target_pos, const Eigen::Vector3d &target_vel,
|
Using the bit mask to ignore yaw. Its a cleaner interface. |
… practice to name private variables
…ecause its the typical approach
Hello @Jaeyoung-Lim Did you the chance to review the pull request? |
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.
Sorry for the late review.
I think the yaw ignore implementation looks good on the geometric_controller side, but on the trajectory_publisher it seems like the yaw is assumed to be in the direction of velocity. I don't think this is a generally applicable assumption to make and usually not the behavior we want.
@@ -147,7 +147,11 @@ void geometricCtrl::flattargetCallback(const controller_msgs::FlatTarget &msg) { | |||
|
|||
targetPos_ = toEigen(msg.position); | |||
targetVel_ = toEigen(msg.velocity); | |||
|
|||
if( (msg.type_mask & 8) == 8) // Ignore yaw |
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.
if( (msg.type_mask & 8) == 8) // Ignore yaw | |
if( (msg.type_mask == controller_msgs::IGNORE_YAW) // Ignore yaw |
@@ -147,7 +147,11 @@ void geometricCtrl::flattargetCallback(const controller_msgs::FlatTarget &msg) { | |||
|
|||
targetPos_ = toEigen(msg.position); | |||
targetVel_ = toEigen(msg.velocity); | |||
|
|||
if( (msg.type_mask & 8) == 8) // Ignore yaw | |||
mavYaw_ = 0.0; |
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.
If you are ignoring yaw, you should not set the yaw to zero. Otherwise this is resetting the yaw setpoint to zero
msg.acceleration.z = a_targ(2); | ||
|
||
if(ignore_yaw_) { | ||
msg.type_mask |= 8; |
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.
msg.type_mask |= 8; | |
msg.type_mask |=controller_msgs::IGNORE_YAW |
@@ -70,6 +70,7 @@ trajectoryPublisher::trajectoryPublisher(const ros::NodeHandle& nh, const ros::N | |||
nh_private_.param<int>("trajectory_type", trajectory_type_, 0); | |||
nh_private_.param<int>("number_of_primitives", num_primitives_, 7); | |||
nh_private_.param<int>("reference_type", pubreference_type_, 2); | |||
nh_private_.param<bool>("ignore_yaw", ignore_yaw_, false); |
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.
I think the flag is a bit inaccurate. The trajectory publisher not ignoring yaw but more whether you want to publish yaw.
Eigen::Vector3d velocity = getVelocity(time); // Yaw is set in the direction of the vehicle | ||
float yaw = atan2f(velocity(1),velocity(0)); | ||
return yaw; | ||
} |
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.
I don't think yaw should be always aligned with the velocity for polynomial trajectories.
@brunopinto900 I am closing this PR as stale. Please reopen if you are willing to continue 😄 |
Problem Description:
This PR adds yaw field to the FlatTarget.msg and any necessary modifications. The circle trajectory now sets yaw to point to the center of the circle at all time.
Additional Context:
This PR is related with #153.
To discuss: