@@ -57,6 +57,8 @@ class SO3CmdToCrazyflie : public nodelet::Nodelet
57
57
int thrust_pwm_min_; // Necessary to overcome stiction
58
58
int thrust_pwm_max_; // Mapped to PWM
59
59
60
+ bool send_ctbr_cmds_;
61
+
60
62
int motor_status_;
61
63
bool armed_;
62
64
int arm_status_;
@@ -263,8 +265,13 @@ void SO3CmdToCrazyflie::so3_cmd_callback(const kr_mav_msgs::SO3Command::ConstPtr
263
265
// TODO change this check to be a param
264
266
// throttle the publish rate
265
267
// if ((ros::Time::now() - last_so3_cmd_time_).toSec() > 1.0/30.0){
266
- crazy_vel_cmd->linear .y = roll_des + msg->aux .angle_corrections [0 ];
267
- crazy_vel_cmd->linear .x = pitch_des + msg->aux .angle_corrections [1 ];
268
+ if (send_ctbr_cmds_) {
269
+ crazy_vel_cmd->linear .y = msg->angular_velocity .x ; // ctbr_cmd->angular_velocity.x = roll rate
270
+ crazy_vel_cmd->linear .x = msg->angular_velocity .y ; // ctbr_cmd->angular_velocity.y = pitch rate
271
+ } else {
272
+ crazy_vel_cmd->linear .y = roll_des + msg->aux .angle_corrections [0 ];
273
+ crazy_vel_cmd->linear .x = pitch_des + msg->aux .angle_corrections [1 ];
274
+ }
268
275
crazy_vel_cmd->linear .z = CLAMP (thrust_pwm, thrust_pwm_min_, thrust_pwm_max_);
269
276
270
277
// ROS_INFO("commanded thrust is %2.2f", CLAMP(thrust_pwm, thrust_pwm_min_, thrust_pwm_max_));
@@ -306,6 +313,9 @@ void SO3CmdToCrazyflie::onInit(void)
306
313
// get param for so3 command timeout duration
307
314
priv_nh.param (" so3_cmd_timeout" , so3_cmd_timeout_, 0.1 );
308
315
316
+ // get param for sending ctbr cmds, default is to send TRPY commands as attitude
317
+ priv_nh.param (" send_ctbr_cmds" , send_ctbr_cmds_, false );
318
+
309
319
priv_nh.param (" thrust_pwm_max" , thrust_pwm_max_, 60000 );
310
320
priv_nh.param (" thrust_pwm_min" , thrust_pwm_min_, 10000 );
311
321
0 commit comments