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

Fix Linting errors #2016

Merged
merged 4 commits into from
Jan 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 22 additions & 20 deletions mavros_extras/src/plugins/landing_target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,41 +464,43 @@ class LandingTargetPlugin : public plugin::Plugin,
Eigen::Vector3d position = Eigen::Vector3d::Zero();
Eigen::Quaterniond orientation = Eigen::Quaterniond::Identity();
bool position_valid = false;

const auto data_frame = static_cast<MAV_FRAME>(req->frame);
switch(data_frame) {
case MAV_FRAME::LOCAL_NED: {
position = ftf::transform_frame_enu_ned(Eigen::Vector3d(tr.translation()));
orientation = ftf::transform_orientation_enu_ned(
position = ftf::transform_frame_enu_ned(Eigen::Vector3d(tr.translation()));
orientation = ftf::transform_orientation_enu_ned(
ftf::transform_orientation_baselink_aircraft(Eigen::Quaterniond(tr.rotation()))
);
position_valid = true;
break;
}
);
position_valid = true;
break;
}
case MAV_FRAME::BODY_FRD: {
position = ftf::transform_frame_baselink_aircraft(Eigen::Vector3d(tr.translation()));
orientation = ftf::transform_orientation_baselink_aircraft(Eigen::Quaterniond(tr.rotation()));
position_valid = true;
break;
}
position = ftf::transform_frame_baselink_aircraft(Eigen::Vector3d(tr.translation()));
orientation = ftf::transform_orientation_baselink_aircraft(
Eigen::Quaterniond(tr.rotation()));
position_valid = true;
break;
}
default: {
//Raise a warning if a non-zero frame value is provided
//XXX: This is no ideal given that "0" is "MAV_FRAME::GLOBAL"
// Raise a warning if a non-zero frame value is provided
// XXX: This is no ideal given that "0" is "MAV_FRAME::GLOBAL"
// however this would be the "default value" for anyone
// using this interface without setting frame correctly
// using this interface without setting frame correctly
//
// The better option would be to expose "position_valid"
// in mavros_msgs::msg::LandingTarget, but this will at
// least allow people to use the angle interface without
// getting a constant error stream.
if(data_frame != MAV_FRAME::GLOBAL)
RCLCPP_WARN_STREAM(
if(data_frame != MAV_FRAME::GLOBAL) {
RCLCPP_WARN_STREAM(
get_logger(),
"LT: Landing target frame '" << req->frame << "' is not supported"
);
}
);
}
}
}

landing_target(
rclcpp::Time(req->header.stamp).nanoseconds() / 1000,
req->target_num,
Expand Down
Loading