@@ -233,7 +233,7 @@ void geometricCtrl::cmdloopCallback(const ros::TimerEvent &event) {
233
233
case MISSION_EXECUTION:
234
234
if (!feedthrough_enable_) computeBodyRateCmd (cmdBodyRate_, targetPos_, targetVel_, targetAcc_);
235
235
pubReferencePose (targetPos_, q_des);
236
- pubRateCommands (cmdBodyRate_);
236
+ pubRateCommands (cmdBodyRate_, q_des );
237
237
appendPoseHistory ();
238
238
pubPoseHistory ();
239
239
break ;
@@ -295,7 +295,7 @@ void geometricCtrl::pubReferencePose(const Eigen::Vector3d &target_position, con
295
295
referencePosePub_.publish (msg);
296
296
}
297
297
298
- void geometricCtrl::pubRateCommands (const Eigen::Vector4d &cmd) {
298
+ void geometricCtrl::pubRateCommands (const Eigen::Vector4d &cmd, const Eigen::Vector4d &target_attitude ) {
299
299
mavros_msgs::AttitudeTarget msg;
300
300
301
301
msg.header .stamp = ros::Time::now ();
@@ -304,6 +304,10 @@ void geometricCtrl::pubRateCommands(const Eigen::Vector4d &cmd) {
304
304
msg.body_rate .y = cmd (1 );
305
305
msg.body_rate .z = cmd (2 );
306
306
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 );
307
311
msg.thrust = cmd (3 );
308
312
309
313
angularVelPub_.publish (msg);
0 commit comments