ArduPilot 第10章 RC

本文详细解读了ArdupilotArduCopter源码中的遥控器输入初始化过程,包括RCChannels的设置、PWM信号转换为角度或范围、以及如何将RC输入传递到电机进行控制。重点介绍了关键函数如`init_ardupilot()`、`read_radio()`和`radio_passthrough_to_motors()`的工作原理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


参考文章
Ardupilot-ArduCopter-3.2.1 源码解读
https://www.renrendoc.com/paper/164558851.html

APM(Ardupilot)——遥控器RC input
https://blog.youkuaiyun.com/yinxian5224/article/details/102744285

RC输入和输出
https://emotionfly.blog.youkuaiyun.com/article/details/127862084?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-127862084-blog-102836314.235%5Ev43%5Epc_blog_bottom_relevance_base5&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1-127862084-blog-102836314.235%5Ev43%5Epc_blog_bottom_relevance_base5&utm_relevant_index=2

APM_ArduCopter源码解析学习(二)——电机库学习
https://blog.youkuaiyun.com/zhangfengmei1987/article/details/110448094

四旋翼飞行器搭建教程(px4ardupoilotapm )讲诉
https://www.renrendoc.com/paper/212794803.html

前言

本文介绍ArduPilot 的radio相关内容。

RC 输入:这是飞控板接收来自遥控器的信号。遥控器的摇杆、开关和按钮产生的输入信号被转换为 PWM 信号,用于控制飞行器的运动、姿态和其他功能。例如,升降、横滚、俯仰和偏航通常由 RC 输入控制。

RC 输出:这是飞控板向执行器发送的信号。执行器可以是伺服、电机、电调等。通过调整 PWM 信号的脉冲宽度,可以控制执行器的位置、速度和扭矩。例如,电机的转速、伺服的位置和舵面的角度都由 RC 输出控制。


一、遥控器输入初始化

1.init_ardupilot()

\ArduCopter\system.cpp

void Copter::init_ardupilot()
{
   
	...
	init_rc_in();               
    rc().init();
	...
}

2.init_rc_in()

横滚通道:[-4500,4500] ;
俯仰通道:[-4500,4500] ;
偏航通道:[-4500,4500] ;
油门通道:[0,1000] ;
其他外部通道值:0-1000
\ArduCopter\radio.cpp

void Copter::init_rc_in()
{
   
    channel_roll     = rc().channel(rcmap.roll()-1);
    channel_pitch    = rc().channel(rcmap.pitch()-1);
    channel_throttle = rc().channel(rcmap.throttle()-1);
    channel_yaw      = rc().channel(rcmap.yaw()
### ArduPilot RC Pin Configuration and Usage For configuring the Remote Control (RC) pins on an ArduPilot system, it involves understanding how these pins are designated for different functions depending upon the board being used. The configuration typically revolves around setting up PWM or PPM inputs which receive signals from a receiver connected to the flight controller. In most cases with ArduPilot-supported boards like Pixhawk series, specific GPIOs are pre-defined as RC input channels where each channel corresponds to controls such as roll, pitch, throttle, yaw, mode switch etc.[^1] To configure these settings: The parameters related to RC can be adjusted via Mission Planner software under **Configuration → Full Parameter List**, searching for `BRD_PWM_COUNT` indicating number of PWM outputs available along with other relevant parameters starting with prefix `RC_`. Additionally, when interfacing hardware components using Arduino IDE serial monitor might come handy during debugging sessions ensuring proper communication between devices. #### Example Code Snippet Demonstrating Basic Initialization ```cpp #include <AP_HAL.h> const uint8_t rc_channel_count = 8; float rc_input_values[rc_channel_count]; void setup() { hal.rcin->init(); } void loop() { if(hal.scheduler->millis() > 100){ for(uint8_t i=0;i<rc_channel_count;i++){ rc_input_values[i]=hal.rcin->read(i); } } } ``` This code initializes the RC input subsystem and reads values periodically demonstrating basic interaction pattern one would follow while working directly at this level within firmware development context. --related questions-- 1. How does one calibrate ESCs connected through these RC pins? 2. What tools besides Mission Planner could assist in tuning PID gains associated with RC control loops? 3. Can custom logic levels be defined for digital signal processing involving RC pin configurations? 4. Is there any difference in handling analog versus pulse width modulation type receivers concerning RC pin setups?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值