mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-08 10:32:26 +08:00
ardrone flying now (still workaround of disabled rates controller)
This commit is contained in:
@@ -127,8 +127,8 @@ static void *rate_control_thread_main(void *arg)
|
||||
gyro_lp[1] = gyro_report.y;
|
||||
gyro_lp[2] = gyro_report.z;
|
||||
|
||||
// multirotor_control_rates(&rates_sp, gyro_lp, &actuators);
|
||||
// orb_publish(ORB_ID_VEHICLE_ATTITUDE_CONTROLS, actuator_pub, &actuators);
|
||||
multirotor_control_rates(&rates_sp, gyro_lp, &actuators);
|
||||
orb_publish(ORB_ID_VEHICLE_ATTITUDE_CONTROLS, actuator_pub, &actuators);
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -192,10 +192,10 @@ mc_thread_main(int argc, char *argv[])
|
||||
|
||||
/* ready, spawn pthread */
|
||||
pthread_attr_t rate_control_attr;
|
||||
pthread_attr_init(&rate_control_attr);
|
||||
pthread_attr_setstacksize(&rate_control_attr, 2048);
|
||||
pthread_t rate_control_thread;
|
||||
pthread_create(&rate_control_thread, &rate_control_attr, rate_control_thread_main, NULL);
|
||||
// pthread_attr_init(&rate_control_attr);
|
||||
// pthread_attr_setstacksize(&rate_control_attr, 2048);
|
||||
// pthread_t rate_control_thread;
|
||||
// pthread_create(&rate_control_thread, &rate_control_attr, rate_control_thread_main, NULL);
|
||||
|
||||
while (!thread_should_exit) {
|
||||
|
||||
@@ -306,7 +306,7 @@ mc_thread_main(int argc, char *argv[])
|
||||
perf_print_counter(mc_loop_perf);
|
||||
perf_free(mc_loop_perf);
|
||||
|
||||
pthread_join(rate_control_thread, NULL);
|
||||
//pthread_join(rate_control_thread, NULL);
|
||||
|
||||
fflush(stdout);
|
||||
exit(0);
|
||||
@@ -340,6 +340,7 @@ int multirotor_att_control_main(int argc, char *argv[])
|
||||
default:
|
||||
fprintf(stderr, "option: -%c\n", ch);
|
||||
usage("unrecognized option");
|
||||
break;
|
||||
}
|
||||
}
|
||||
argc -= optioncount;
|
||||
|
||||
@@ -968,7 +968,7 @@ Sensors::ppm_poll()
|
||||
_rc.chan[i].scaled = (ppm_buffer[i] - _parameters.trim[i]) / (float)(_parameters.max[i] - _parameters.trim[i]);
|
||||
} else if (ppm_buffer[i] < (_parameters.trim[i] - _parameters.dz[i])) {
|
||||
/* division by zero impossible for trim == min (as for throttle), as this falls in the above if clause */
|
||||
_rc.chan[i].scaled = -1.0f + ((ppm_buffer[i] - _parameters.min[i]) / (float)(_parameters.trim[i] - _parameters.min[i]));
|
||||
_rc.chan[i].scaled = -((_parameters.trim[i] - ppm_buffer[i]) / (float)(_parameters.trim[i] - _parameters.min[i]));
|
||||
|
||||
} else {
|
||||
/* in the configured dead zone, output zero */
|
||||
@@ -1029,6 +1029,8 @@ Sensors::ppm_poll()
|
||||
|
||||
orb_publish(ORB_ID(rc_channels), _rc_pub, &_rc);
|
||||
orb_publish(ORB_ID(manual_control_setpoint), _manual_control_pub, &manual_control);
|
||||
|
||||
// printf("SENSORS: Roll: %4.4f, Pitch: %4.4f, Yaw: %4.4f, Thrust: %4.4f\n",manual_control.roll, manual_control.pitch, manual_control.yaw, manual_control.throttle);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user