mirror of
https://gitee.com/dlmu-cone/bf_original_balance_chassis
synced 2026-07-24 03:27:45 +08:00
搭建了chassis的框架
This commit is contained in:
@@ -178,7 +178,7 @@ uint8_t SubGetMessage(Subscriber_t *sub, void *data_ptr)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void PubPushMessage(Publisher_t *pub, void *data_ptr)
|
||||
uint8_t PubPushMessage(Publisher_t *pub, void *data_ptr)
|
||||
{
|
||||
Subscriber_t *iter = pub->first_subs; // iter作为订阅者指针,遍历订阅该事件的所有订阅者;如果为空说明遍历结束
|
||||
while (iter) // 遍历订阅了当前事件的所有订阅者,依次填入最新消息
|
||||
@@ -195,4 +195,5 @@ void PubPushMessage(Publisher_t *pub, void *data_ptr)
|
||||
|
||||
iter = iter->next_subs_queue; // 访问下一个订阅者
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -109,7 +109,8 @@ uint8_t SubGetMessage(Subscriber_t* sub,void* data_ptr);
|
||||
*
|
||||
* @param pub 发布者实例指针
|
||||
* @param data_ptr 指向要发布的数据的指针
|
||||
* @return uint8_t 新消息成功推送给几个订阅者
|
||||
*/
|
||||
void PubPushMessage(Publisher_t* pub,void* data_ptr);
|
||||
uint8_t PubPushMessage(Publisher_t* pub,void* data_ptr);
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#define ECD_ANGLE_COEF 0.043945f // 360/8192
|
||||
|
||||
static uint8_t idx = 0; // register idx,是该文件的全局电机索引,在注册时使用
|
||||
static uint8_t stop_flag=0;
|
||||
|
||||
/* DJI电机的实例,此处仅保存指针,内存的分配将通过电机实例初始化时通过malloc()进行 */
|
||||
static dji_motor_instance *dji_motor_info[DJI_MOTOR_CNT] = {NULL};
|
||||
@@ -256,7 +257,16 @@ void DJIMotorControl()
|
||||
{
|
||||
if (sender_enable_flag[i])
|
||||
{
|
||||
if(stop_flag) // 如果紧急停止,将所有发送信息置零
|
||||
{
|
||||
memset(sender_assignment[i].tx_buff,0,8);
|
||||
}
|
||||
CANTransmit(&sender_assignment[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DJIMotorStop()
|
||||
{
|
||||
stop_flag=1;
|
||||
}
|
||||
|
||||
@@ -106,4 +106,10 @@ void DJIMotorChangeFeed(dji_motor_instance *motor, Closeloop_Type_e loop, Feedba
|
||||
void DJIMotorControl();
|
||||
|
||||
|
||||
/**
|
||||
* @brief 停止所有电机
|
||||
*
|
||||
*/
|
||||
void DJIMotorStop();
|
||||
|
||||
#endif // !DJI_MOTOR_H
|
||||
|
||||
Reference in New Issue
Block a user