copter的throttle_loop()任务定义在任务列表中

1 //频率 50   最大运行时间75us
2 SCHED_TASK(throttle_loop,         50,     75),
throttle_loop - 应该以50HZ运行
 1 void Copter::throttle_loop()
 2 {
 3     //更新throttle_low_comp值(控制油门的优先级 VS 高度控制)
 4     update_throttle_mix();
 5     
 6     //检查自动armed状态
 7     update_auto_armed();
 8     
 9     
10     //补偿地面效应
11     update_ground_effect_detector();
12     update_ekf_terrain_height_stable();
13 }
update_throttle_mix
1 //根据vehicle状态来设置电机throttle_low_comp值
2 //当油门高于悬停油门时,较低的值优先于飞行员/自动驾驶油门而不是姿态控制,而较高的值则优先于姿态控制而不是油门 
3 void Copter::update_throttle_mix()
4 {
5     attitude_control->set_throttle_mix_man();
6 }
AC_AttitudeControl_Multi
1 class AC_AttitudeControl_Multi
2 {
3     //设置所需的油门与姿态混合 (实际混合会在1到2秒内转换为该值 )
4     void set_throttle_mix_min() override { _throttle_rpy_mix_desired = _thr_mix_min}; 
5 }
ap_t
 1 typedef union 
 2 {
 3         struct 
 4         {
 5             uint8_t unused1                 : 1; // 0
 6             uint8_t unused_was_simple_mode  : 2; // 1,2
 7             uint8_t pre_arm_rc_check        : 1; // 3       
 8             //当rc 输入 pre-arm检查已经完全成功时为真
 9             uint8_t pre_arm_check           : 1; // 4  
10         //当所有的pre-arm检查(rc,accel,calibration,gps,lock)已经被执行时,为真
11             uint8_t auto_armed              : 1; // 5       
12             //从开始停止自动执行,直到油门上升
13             uint8_t logging_started         : 1; // 6       
14             //日志记录开始就为真
15             uint8_t land_complete           : 1; // 7       
16             //当探测到着陆就为真
17             uint8_t new_radio_frame         : 1; // 8       
18             //当来自radio的pwm数据来执行时,为真
19             uint8_t usb_connected_unused    : 1; // 9       // UNUSED
20             uint8_t rc_receiver_present     : 1; // 10      
21             //有rc接收机时为真
22             uint8_t compass_mot             : 1; // 11      
23             //正在进行罗盘校准为真
24             uint8_t motor_test              : 1; // 12      
25             //执行电机测试时为真
26             uint8_t initialised             : 1; // 13      
27             //一旦init_ardupilot函数完成,就为真,到gps的扩展状态不发送,直到这个完成
28             uint8_t land_complete_maybe     : 1; // 14      
29             //如果已经着陆就为真
30             uint8_t throttle_zero           : 1; // 15      
31             // 如果油门杆为零且反跳,则为true,它确定飞行员是否在不使用电动机互锁时打算关闭 
32             uint8_t system_time_set_unused  : 1; // 16      
33             //系统时间已经从cps设置,为真
34             uint8_t gps_glitching           : 1; // 17  
35             //GPS错误影响导航准确度
36             uint8_t using_interlock         : 1; // 20      
37             // aux switch motor interlock function is in use
38             //辅助开关电机互锁功能在使用
39             uint8_t land_repo_active        : 1; // 21      
40             // 如果飞行员超越着陆位置,则为true 
41             uint8_t motor_interlock_switch  : 1; // 22      
42             // 如果飞行员请求启用电机互锁,则为true
43             uint8_t in_arming_delay         : 1; // 23      
44             // 当我们武装但正在等待旋转电机时为真
45             uint8_t initialised_params      : 1; // 24      
46             // true when the all parameters have been initialised. we cannot send parameters to the GCS until this is done
47             //当所有参数已经初始化,我们不能发送参数到GPS,直到这个完成
48             uint8_t unused3                 : 1; // 25      
49             
50             //当指南针的初始化位置已经设置为真,
51             uint8_t unused2                 : 1; // 26      
52             //辅助开关rc_override是允许的
53             uint8_t armed_with_switch       : 1; // 27      
54             //使用arm开关来armed
55         };
56         uint32_t value;
57 } ap_t;
update_auto_armed
1 //更新auto_armed标志的状态
2 void Copter::update_auto_armed()
3 {
4  if(ap.auto_armed)
5  {
6  }
7 }
baro_ground_effect.cpp
1 void update_ground_effect_detector(void);

 

内容来源于网络如有侵权请私信删除

文章来源: 博客园

原文链接: https://www.cnblogs.com/beepeg/p/14473375.html

你还没有登录,请先登录注册
  • 还没有人评论,欢迎说说您的想法!

相关课程