Browse Source

船双雷达模式,纳雷版

prx_boat_2
zbr 3 years ago
parent
commit
247dc99db7
  1. 56
      App/freertos_action.c
  2. 24
      BSP/insifhtica_QOAR1271.c
  3. 12
      MDK-ARM/proximity_uavcan_converter.uvguix.zengb
  4. 6
      MDK-ARM/proximity_uavcan_converter.uvoptx

56
App/freertos_action.c

@ -155,44 +155,46 @@ void task_proximity(void)
{ {
os_p1 = osMessageQueueGet(proximity1_queueHandle, &proximity1, NULL, 120); os_p1 = osMessageQueueGet(proximity1_queueHandle, &proximity1, NULL, 120);
os_p2 = osMessageQueueGet(proximity2_queueHandle, &proximity2, NULL, 120); os_p2 = osMessageQueueGet(proximity2_queueHandle, &proximity2, NULL, 120);
if((os_p1 == osOK) || (os_p2 == osOK)){ // if((os_p1 == osOK) || (os_p2 == osOK)){
uavcan_proximity_t data = {0}; // uavcan_proximity_t data = {0};
data.d0 = proximity1.d0; // data.d0 = proximity1.d0;
data.d45 = proximity1.d45; // data.d45 = proximity1.d45;
data.d90 = proximity1.d90; // data.d90 = proximity1.d90;
data.d135 = proximity1.d135; // data.d135 = proximity1.d135;
data.d180 = proximity1.d180; // data.d180 = proximity1.d180;
data.d225 = proximity1.d225; // data.d225 = proximity1.d225;
data.d270 = proximity1.d270; // data.d270 = proximity1.d270;
data.d315 = proximity1.d315; // data.d315 = proximity1.d315;
send_uavcan_proximity(&data); // send_uavcan_proximity(&data);
} // }
// if ((os_p1 == osOK) && (os_p2 == osOK)) // if ((os_p1 == osOK) && (os_p2 == osOK))
// { // {
// uavcan_proximity_t data = {0}; // uavcan_proximity_t data = {0};
// data.d0 = min(proximity1.d0, proximity2.d0); // data.d0 = min(proximity1.d0, proximity2.d0);
// data.d315 = proximity1.d315; // data.d90 = proximity1.d90;
// data.d45 = proximity2.d45; // data.d45 = proximity2.d45;
// send_uavcan_proximity(&data); // send_uavcan_proximity(&data);
// } // }
// else // else
// { // {
// if (os_p1 == osOK) //左边的雷达是反的 uavcan_proximity_t data = {0};
// { data.d0 = min(proximity1.d0, proximity2.d0);
if (os_p1 == osOK) //左边的雷达是反的
{
// uavcan_proximity_t data = {0}; // uavcan_proximity_t data = {0};
// data.d0 = proximity1.d0; data.d0 = proximity1.d0;
// data.d315 = proximity1.d315; // data.d45 = proximity1.d90;
// data.d45 = proximity1.d45; data.d90 = proximity1.d45;
// send_uavcan_proximity(&data); send_uavcan_proximity(&data);
// } }
// else if (os_p2 == osOK) else if (os_p2 == osOK)
// { {
// uavcan_proximity_t data = {0}; // uavcan_proximity_t data = {0};
// data.d0 = proximity2.d0; data.d0 = proximity2.d0;
// data.d315 = proximity2.d315; data.d45 = proximity2.d45;
// data.d45 = proximity2.d45; // data.d90 = proximity2.d90;
// send_uavcan_proximity(&data); send_uavcan_proximity(&data);
// } }
// } // }
} }
} }

24
BSP/insifhtica_QOAR1271.c

@ -34,7 +34,7 @@ void decode_ar1271(char c,uint8_t index);
bool decode_mr72(int16_t c); bool decode_mr72(int16_t c);
void data_process_old(void); void data_process_old(void);
void data_process(void); void data_process(uint8_t index);
void sortA1(uint16_t a[], uint8_t length); void sortA1(uint16_t a[], uint8_t length);
extern void parse_ar1271_data(usart_data_t *usart_data) extern void parse_ar1271_data(usart_data_t *usart_data)
@ -50,7 +50,7 @@ extern void parse_ar1271_data(usart_data_t *usart_data)
decode_ar1271(c,usart_data->usart_instance); decode_ar1271(c,usart_data->usart_instance);
} }
} }
data_process(); data_process(usart_data->usart_instance);
osSemaphoreRelease(radar_parse_mutexHandle); osSemaphoreRelease(radar_parse_mutexHandle);
} }
@ -182,7 +182,7 @@ bool decode_mr72(int16_t c)
// range_index +=1; // range_index +=1;
// } // }
// } // }
if(mr72_c_data.azimuth < 30.0 && mr72_c_data.azimuth > -30.0){ // 中间区域 if(mr72_c_data.azimuth < 45.0 && mr72_c_data.azimuth > -45.0){ // 中间区域
int8_t had_index = -1; int8_t had_index = -1;
for(uint8_t i=0; i<range_index; i++){ for(uint8_t i=0; i<range_index; i++){
if(index_arr[i] == mr72_c_data.index){ if(index_arr[i] == mr72_c_data.index){
@ -212,7 +212,7 @@ bool decode_mr72(int16_t c)
return ret; return ret;
} }
void data_process(void){ void data_process(uint8_t index){
// 其中一个区块数据更新 // 其中一个区块数据更新
if (proximity1_queueHandle != NULL && HAL_GetTick() - uavcan_data_tick > 100) // uavcan发送,50ms间隔 if (proximity1_queueHandle != NULL && HAL_GetTick() - uavcan_data_tick > 100) // uavcan发送,50ms间隔
{ {
@ -243,7 +243,23 @@ void data_process(void){
data.d270 = MAX_MR71_DIST_CM; data.d270 = MAX_MR71_DIST_CM;
data.d315 = MAX_MR71_DIST_CM; data.d315 = MAX_MR71_DIST_CM;
} }
// myOsMessageQueuePut(proximity1_queueHandle, &data, 0, 10);
if (index == 1)
{
if (proximity1_queueHandle != NULL)
{
myOsMessageQueuePut(proximity1_queueHandle, &data, 0, 10); myOsMessageQueuePut(proximity1_queueHandle, &data, 0, 10);
}
}
else if (index == 2)
{
if (proximity2_queueHandle != NULL)
{
myOsMessageQueuePut(proximity2_queueHandle, &data, 0, 10);
}
}
uavcan_data_tick = HAL_GetTick(); uavcan_data_tick = HAL_GetTick();
} }

12
MDK-ARM/proximity_uavcan_converter.uvguix.zengb

File diff suppressed because one or more lines are too long

6
MDK-ARM/proximity_uavcan_converter.uvoptx

@ -186,16 +186,16 @@
<Type>0</Type> <Type>0</Type>
<LineNumber>127</LineNumber> <LineNumber>127</LineNumber>
<EnabledFlag>1</EnabledFlag> <EnabledFlag>1</EnabledFlag>
<Address>134250276</Address> <Address>0</Address>
<ByteObject>0</ByteObject> <ByteObject>0</ByteObject>
<HtxType>0</HtxType> <HtxType>0</HtxType>
<ManyObjects>0</ManyObjects> <ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject> <SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess> <BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount> <BreakIfRCount>0</BreakIfRCount>
<Filename>..\BSP\insifhtica_QOAR1271.c</Filename> <Filename>..\BSP\insifhtica_QOAR1271.c</Filename>
<ExecCommand></ExecCommand> <ExecCommand></ExecCommand>
<Expression>\\proximity_uavcan_converter\../BSP/insifhtica_QOAR1271.c\127</Expression> <Expression></Expression>
</Bp> </Bp>
</Breakpoint> </Breakpoint>
<WatchWindow1> <WatchWindow1>

Loading…
Cancel
Save