Skip to content

Commit

Permalink
Hack heading quad
Browse files Browse the repository at this point in the history
  • Loading branch information
aftersomemath authored and pittras committed Jul 22, 2018
1 parent 3f247e2 commit f3df000
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions include/iarc7_fc_comms/CommonFcComms.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,15 @@ orientation_timestamp_offset_()
sequenced_updates.push_back(&CommonFcComms::updateBattery);
}

initial_heading_as_offset_ =
initial_heading_as_offset_ =
ros_utils::ParamUtils::getParam<bool>(
private_nh_, "initial_heading_as_offset");

calibrate_accelerometer_ =
calibrate_accelerometer_ =
ros_utils::ParamUtils::getParam<bool>(
private_nh_, "calibrate_accelerometer");

publish_orientation_transform_ =
publish_orientation_transform_ =
ros_utils::ParamUtils::getParam<bool>(
private_nh_, "publish_orientation_transform");

Expand Down Expand Up @@ -551,7 +551,7 @@ template<class T>
void CommonFcComms<T>::activateFcSafety()
{
FcCommsReturns status = flightControlImpl_.safetyLand();

if (status == FcCommsReturns::kReturnOk) {
ROS_WARN("iarc7_fc_comms: succesfully sent safety land request");
} else {
Expand Down Expand Up @@ -710,6 +710,20 @@ void CommonFcComms<T>::sendOrientation(double (&attitude)[3])
transformStamped.transform.rotation.w = q.w();

transform_broadcaster_.sendTransform(transformStamped);

transformStamped.header.stamp = ros::Time::now() + orientation_timestamp_offset_;
transformStamped.header.frame_id = CommonConf::kTfParentName;
transformStamped.child_frame_id = "heading_quad";

//tf2::Quaternion q;
// This assumes the values are returned in the form roll pitch yaw in radians
q.setRPY(0.0, 0.0, -attitude[2]);
transformStamped.transform.rotation.x = q.x();
transformStamped.transform.rotation.y = q.y();
transformStamped.transform.rotation.z = q.z();
transformStamped.transform.rotation.w = q.w();

transform_broadcaster_.sendTransform(transformStamped);
}
}

Expand Down

0 comments on commit f3df000

Please sign in to comment.