Browse Source

crazyflie: fix PWM channel ordering

Channels belonging to a certain timer were not all grouped together.
This is required by the .first_channel_index and .last_channel_index data
members.

We introduce a new mixer geometry to solve the problem.
sbg
Beat Küng 5 years ago committed by David Sidrane
parent
commit
73bd90ddd5
  1. 2
      ROMFS/px4fmu_common/init.d/airframes/4900_crazyflie
  2. 1
      ROMFS/px4fmu_common/mixers/CMakeLists.txt
  3. 5
      ROMFS/px4fmu_common/mixers/quad_x_cw.main.mix
  4. 18
      boards/bitcraze/crazyflie/src/timer_config.c
  5. 1
      src/lib/mixer/MultirotorMixer/CMakeLists.txt
  6. 30
      src/lib/mixer/MultirotorMixer/geometries/quad_x_cw.toml

2
ROMFS/px4fmu_common/init.d/airframes/4900_crazyflie

@ -17,7 +17,7 @@
# #
sh /etc/init.d/rc.mc_defaults sh /etc/init.d/rc.mc_defaults
set MIXER quad_x set MIXER quad_x_cw
set PWM_OUT 1234 set PWM_OUT 1234
if [ $AUTOCNF = yes ] if [ $AUTOCNF = yes ]
then then

1
ROMFS/px4fmu_common/mixers/CMakeLists.txt

@ -71,6 +71,7 @@ px4_add_romfs_files(
quad_+_vtol.main.mix quad_+_vtol.main.mix
quad_w.main.mix quad_w.main.mix
quad_x.main.mix quad_x.main.mix
quad_x_cw.main.mix
quad_x_vtol.main.mix quad_x_vtol.main.mix
stampede.main.mix stampede.main.mix
tri_y_yaw-.main.mix tri_y_yaw-.main.mix

5
ROMFS/px4fmu_common/mixers/quad_x_cw.main.mix

@ -0,0 +1,5 @@
# @board px4_fmu-v2 exclude
# Quad X with clock-wise motor assigment
R: 4xcw 10000 10000 10000 0

18
boards/bitcraze/crazyflie/src/timer_config.c

@ -92,6 +92,15 @@ __EXPORT const timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = {
.ccr_offset = STM32_GTIM_CCR2_OFFSET, .ccr_offset = STM32_GTIM_CCR2_OFFSET,
.masks = GTIM_SR_CC2IF | GTIM_SR_CC2OF .masks = GTIM_SR_CC2IF | GTIM_SR_CC2OF
}, },
{
// M2
.gpio_out = GPIO_TIM2_CH4OUT,
.gpio_in = GPIO_TIM2_CH4IN,
.timer_index = 0,
.timer_channel = 4,
.ccr_offset = STM32_GTIM_CCR4_OFFSET,
.masks = GTIM_SR_CC4IF | GTIM_SR_CC4OF
},
{ {
// M3 // M3
.gpio_out = GPIO_TIM2_CH1OUT, .gpio_out = GPIO_TIM2_CH1OUT,
@ -110,13 +119,4 @@ __EXPORT const timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = {
.ccr_offset = STM32_GTIM_CCR4_OFFSET, .ccr_offset = STM32_GTIM_CCR4_OFFSET,
.masks = GTIM_SR_CC4IF | GTIM_SR_CC4OF .masks = GTIM_SR_CC4IF | GTIM_SR_CC4OF
}, },
{
// M2
.gpio_out = GPIO_TIM2_CH4OUT,
.gpio_in = GPIO_TIM2_CH4IN,
.timer_index = 0,
.timer_channel = 4,
.ccr_offset = STM32_GTIM_CCR4_OFFSET,
.masks = GTIM_SR_CC4IF | GTIM_SR_CC4OF
},
}; };

1
src/lib/mixer/MultirotorMixer/CMakeLists.txt

@ -48,6 +48,7 @@ set(geometry_files
quad_s250aq.toml quad_s250aq.toml
quad_vtail.toml quad_vtail.toml
quad_wide.toml quad_wide.toml
quad_x_cw.toml
quad_x.toml quad_x.toml
quad_x_pusher.toml quad_x_pusher.toml
quad_y.toml quad_y.toml

30
src/lib/mixer/MultirotorMixer/geometries/quad_x_cw.toml

@ -0,0 +1,30 @@
# Generic Quadcopter in X configuration
# with clock-wise motor numbering
[info]
key = "4xcw"
description = "Quadcopter in X configuration with clock-wise motor numbering"
[rotor_default]
direction = "CW"
axis = [0.0, 0.0, -1.0]
Ct = 1.0
Cm = 0.05
[[rotors]]
name = "front_right"
position = [0.707107, 0.707107, 0.0]
direction = "CCW"
[[rotors]]
name = "rear_right"
position = [-0.707107, 0.707107, 0.0]
[[rotors]]
name = "rear_left"
position = [-0.707107, -0.707107, 0.0]
direction = "CCW"
[[rotors]]
name = "front_left"
position = [0.707107, -0.707107, 0.0]
Loading…
Cancel
Save