@@ -233,7 +233,7 @@ void geometricCtrl::cmdloopCallback(const ros::TimerEvent &event) {
233233 case MISSION_EXECUTION:
234234 if (!feedthrough_enable_) computeBodyRateCmd (cmdBodyRate_, targetPos_, targetVel_, targetAcc_);
235235 pubReferencePose (targetPos_, q_des);
236- pubRateCommands (cmdBodyRate_);
236+ pubRateCommands (cmdBodyRate_, q_des );
237237 appendPoseHistory ();
238238 pubPoseHistory ();
239239 break ;
@@ -295,7 +295,7 @@ void geometricCtrl::pubReferencePose(const Eigen::Vector3d &target_position, con
295295 referencePosePub_.publish (msg);
296296}
297297
298- void geometricCtrl::pubRateCommands (const Eigen::Vector4d &cmd) {
298+ void geometricCtrl::pubRateCommands (const Eigen::Vector4d &cmd, const Eigen::Vector4d &target_attitude ) {
299299 mavros_msgs::AttitudeTarget msg;
300300
301301 msg.header .stamp = ros::Time::now ();
@@ -304,6 +304,10 @@ void geometricCtrl::pubRateCommands(const Eigen::Vector4d &cmd) {
304304 msg.body_rate .y = cmd (1 );
305305 msg.body_rate .z = cmd (2 );
306306 msg.type_mask = 128 ; // Ignore orientation messages
307+ msg.orientation .w = target_attitude (0 );
308+ msg.orientation .x = target_attitude (1 );
309+ msg.orientation .y = target_attitude (2 );
310+ msg.orientation .z = target_attitude (3 );
307311 msg.thrust = cmd (3 );
308312
309313 angularVelPub_.publish (msg);
0 commit comments