Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1d7b31716c | ||
![]() |
fcbafffa9d | ||
![]() |
aa22993490 | ||
![]() |
30a6841a5b |
@ -796,12 +796,12 @@ void FoodCube::sendSetPositionTargetGlobalInt(double lat_deg, double lon_deg, do
|
|||||||
|
|
||||||
// 设置 type_mask,仅启用位置控制字段,其它字段被忽略
|
// 设置 type_mask,仅启用位置控制字段,其它字段被忽略
|
||||||
sp.type_mask =
|
sp.type_mask =
|
||||||
(1 << 1) | // 忽略 vx
|
(1 << 3) | // 忽略 vx
|
||||||
(1 << 2) | // 忽略 vy
|
(1 << 4) | // 忽略 vy
|
||||||
(1 << 3) | // 忽略 vz
|
(1 << 5) | // 忽略 vz
|
||||||
(1 << 4) | // 忽略 afx
|
(1 << 6) | // 忽略 afx
|
||||||
(1 << 5) | // 忽略 afy
|
(1 << 7) | // 忽略 afy
|
||||||
(1 << 6) | // 忽略 afz
|
(1 << 8) | // 忽略 afz
|
||||||
(1 << 10) | // 忽略 yaw
|
(1 << 10) | // 忽略 yaw
|
||||||
(1 << 11); // 忽略 yaw_rate
|
(1 << 11); // 忽略 yaw_rate
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ void mqtt_receiveCallback(char *topic, byte *payload, unsigned int length)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fc.sendSetPositionTargetGlobalInt(lat, lon, alt); // 发送经纬度和高度
|
fc.sendSetPositionTargetGlobalInt(lat, lon, alt); // 发送纬经度和高度
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (key == "autoMode") // 自动auto模式
|
else if (key == "autoMode") // 自动auto模式
|
||||||
@ -721,12 +721,12 @@ void mavlink_receiveCallback(uint8_t c)
|
|||||||
{
|
{
|
||||||
mavlink_sys_status_t sys_status; // 解构的数据放到这个对象
|
mavlink_sys_status_t sys_status; // 解构的数据放到这个对象
|
||||||
mavlink_msg_sys_status_decode(&msg, &sys_status); // 解构msg数据
|
mavlink_msg_sys_status_decode(&msg, &sys_status); // 解构msg数据
|
||||||
// 电压
|
// // 电压
|
||||||
sprintf(buf, "%.2f", (double)sys_status.voltage_battery / 1000);
|
// sprintf(buf, "%.2f", (double)sys_status.voltage_battery / 1000);
|
||||||
if (topicPubMsg[1] != buf)
|
// if (topicPubMsg[1] != buf)
|
||||||
{ // 有更新 则更新数据
|
// { // 有更新 则更新数据
|
||||||
topicPubMsg[1] = buf;
|
// topicPubMsg[1] = buf;
|
||||||
}
|
// }
|
||||||
// 电流
|
// 电流
|
||||||
sprintf(buf, "%.2f", (double)sys_status.current_battery / 100); // 解构中 1=10毫安 所以这里/100 最终单位是A 安培
|
sprintf(buf, "%.2f", (double)sys_status.current_battery / 100); // 解构中 1=10毫安 所以这里/100 最终单位是A 安培
|
||||||
if (topicPubMsg[2] != buf)
|
if (topicPubMsg[2] != buf)
|
||||||
@ -742,6 +742,28 @@ void mavlink_receiveCallback(uint8_t c)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MAVLINK_MSG_ID_BATTERY_STATUS: // #147: 高压/多电芯电池状态
|
||||||
|
{
|
||||||
|
mavlink_battery_status_t battery_status;
|
||||||
|
mavlink_msg_battery_status_decode(&msg, &battery_status);
|
||||||
|
|
||||||
|
float total_voltage = 0.0f;
|
||||||
|
for (int i = 0; i < 10; ++i)
|
||||||
|
{
|
||||||
|
if (battery_status.voltages[i] != UINT16_MAX)
|
||||||
|
{ // 65535表示无效
|
||||||
|
total_voltage += battery_status.voltages[i] / 1000.0f; // 转换成 V
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(buf, "%.2f", total_voltage); // 转成字符串
|
||||||
|
if (topicPubMsg[1] != buf)
|
||||||
|
{
|
||||||
|
topicPubMsg[1] = buf; // 更新电压显示
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case MAVLINK_MSG_ID_RAW_IMU: // #27: RAW_IMU
|
case MAVLINK_MSG_ID_RAW_IMU: // #27: RAW_IMU
|
||||||
{
|
{
|
||||||
mavlink_raw_imu_t raw_imu;
|
mavlink_raw_imu_t raw_imu;
|
||||||
|
@ -490,9 +490,9 @@ void Task1(void *pvParameters)
|
|||||||
|
|
||||||
_looptm_core0 = millis() - _tm_core0;
|
_looptm_core0 = millis() - _tm_core0;
|
||||||
/*如果循环时间超过100ms,则打印错误日志*/
|
/*如果循环时间超过100ms,则打印错误日志*/
|
||||||
if (_looptm_core0 > 50)
|
if (_looptm_core0 > 200)
|
||||||
{
|
{
|
||||||
addLogMessage("core0 timeout: " + String(_looptm_core0));
|
//addLogMessage("core0 timeout: " + String(_looptm_core0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
#define ROPE_MAXLENGTH 700 // 最多能放700cm---实际绳子应该比这个长750之类的
|
#define ROPE_MAXLENGTH 700 // 最多能放700cm---实际绳子应该比这个长750之类的
|
||||||
// #define WHEEL_DIAMETER 3.8 // 轮子直径cm
|
// #define WHEEL_DIAMETER 3.8 // 轮子直径cm
|
||||||
#define WHEEL_DIAMETER 2.3 // 轮子直径cm 小轮子直径
|
// #define WHEEL_DIAMETER 2.3 // 轮子直径cm 小轮子直径(实际2cm)
|
||||||
|
#define WHEEL_DIAMETER 2 // 轮子直径cm 小轮子直径(实际1.7cm)
|
||||||
#define WHEEL_PERIMETER (WHEEL_DIAMETER * 3.1416) // 轮子周长
|
#define WHEEL_PERIMETER (WHEEL_DIAMETER * 3.1416) // 轮子周长
|
||||||
#define ROPE_MAXCOUNT (ROPE_MAXLENGTH / WHEEL_PERIMETER) // 最大圈数
|
#define ROPE_MAXCOUNT (ROPE_MAXLENGTH / WHEEL_PERIMETER) // 最大圈数
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user