Obtain distance from raw data [D2GL]

Announcements

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
LucaH
Level 2
Level 2
5 likes given First like received 10 sign-ins

Hello!

Im using Distance2GoL (Software-Controlled FMCW radar) 

 

I am trying to obtain the distance parameter when running the example C-Code. However the only printed output doesnt seem to be sufficient to calcualte the distance. And i cant find the distance elsewhere in the code aswell. 

The printed data aswell as the corresponding part in the in code is attached. The code is commlib24_D2GL_basics.c line 555.

"Sample-Data" seems to be a float between 0 and 1 but im not quite sure what that represent. When im trying to use the formular for the distance R in the documentation im missing the variable "fb (beat frequency corresponding to the target).

Is it even possible to extract the raw distance data when using the c-code? I am planing to use the distance as a live parameter for a sound project. 

 

Thanks alot!

luca

0 Likes
1 Solution
Pugitha_N
Moderator
Moderator
Moderator
25 likes received 250 replies posted 100 solutions authored

Hello Luca,

1) The example C-Code of Distance2GoL is having functions of raw data and result of detected target called separately in the main code. The Raw data function fmcw_get_raw_data_cnf_callback prints frame number, chirp number, receiver number, ADC number, number of samples, sample data respectively.

Whereas fmcw_adv_result_cnf_callback function has range or distance, strength, velocity, target status, direction of movement which can be visible later, if you can run the code for more than 2-3 counts.

2)

NarraPugitha_2-1659700557622.png

The function in the above snippet has the range parameter which gives distance of the target.

3) Sample_Data is the data from ADC in the normalized form which will be a float value between 0 and 1.

4) The beat frequency can be obtained using a Fast Fourier Transform(FFT) on Intermediate Frequency (IF)signal to find the distance R, but it is not required for you to do this because Distance2GoL displays the distance as mentioned above.

NarraPugitha_0-1659699760770.png

You can also skip printing the raw data by making  .show_raw_data = false and .show_raw_data_header = false

5) If you want to print the range/distance as a live parameter, you can remove count and run the while loop continuously. 

 
NarraPugitha_0-1659702552809.png

 

Thanks and Regards,

Pugitha

 

 

View solution in original post

6 Replies
Pugitha_N
Moderator
Moderator
Moderator
25 likes received 250 replies posted 100 solutions authored

Hello Luca,

1) The example C-Code of Distance2GoL is having functions of raw data and result of detected target called separately in the main code. The Raw data function fmcw_get_raw_data_cnf_callback prints frame number, chirp number, receiver number, ADC number, number of samples, sample data respectively.

Whereas fmcw_adv_result_cnf_callback function has range or distance, strength, velocity, target status, direction of movement which can be visible later, if you can run the code for more than 2-3 counts.

2)

NarraPugitha_2-1659700557622.png

The function in the above snippet has the range parameter which gives distance of the target.

3) Sample_Data is the data from ADC in the normalized form which will be a float value between 0 and 1.

4) The beat frequency can be obtained using a Fast Fourier Transform(FFT) on Intermediate Frequency (IF)signal to find the distance R, but it is not required for you to do this because Distance2GoL displays the distance as mentioned above.

NarraPugitha_0-1659699760770.png

You can also skip printing the raw data by making  .show_raw_data = false and .show_raw_data_header = false

5) If you want to print the range/distance as a live parameter, you can remove count and run the while loop continuously. 

 
NarraPugitha_0-1659702552809.png

 

Thanks and Regards,

Pugitha

 

 

lock attach
Attachments are accessible only for community members.
LucaH
Level 2
Level 2
5 likes given First like received 10 sign-ins

Hey Pugitha,

thanks a lot for your answer. I managed to print the distance in a loop to the console, independent from the count variable by setting the loop to while(true). So far it's working but now the loop breaks after 100 iterations, which I set as an argument (repeat_count) in the function call in line 785 and 792. Is it possible to run the loop infinitly?

 

best regards

luca

0 Likes
Pugitha_N
Moderator
Moderator
Moderator
25 likes received 250 replies posted 100 solutions authored

Hi LucaH,

Sorry for the delayed response.

If you want to print target status infinitely, place the function 

ep_radar_d2gl_scfmcw_adv_result_req in an infinite loop like while(1). This will print the distance parameter and other target parameters in a continuous stream.  You can extend your loop till line 793 to print the raw data parameters if required.
NarraPugitha_1-1660711051739.png

After using the loop, the repeat_count variable carries no weightage to the code. The code will run infinitely irrespective of the repeat_count value.

Thanks and regards,

Pugitha

LucaH
Level 2
Level 2
5 likes given First like received 10 sign-ins

Hi Pugitha,

thank you very much for your response! I managed to integrate your solution. The next issue is that i am trying to set custom parameters, ideally from a .json or similar, so that compilation after changes of parameters is obsolete. For now I hardcoded the custom parameters in the file "EndpointRadarD2GL.c":

LucaH_0-1660741111102.png

Also i am wondering what exactly max_distance_m_lower_boundary means. As i understand those would be technical limitations and stop the code when the max_distance_m was outside the boundary. But when i set the max_distance_m_lower_boundary to 5 and the max_distance_m to 4 it wouldnt show an error and proceed as usual. 

On a side note: I was also trying to write the parameters to the board via the GUI. But the Make Persistent option didnt seem to stick. Any idea whats going on there? 

One more thing. I understand that the radar has 180 degree reception angle and that cant be altered? For my application a more narrow angle would be better suited.

Thanks alot for your help so far!

0 Likes
Pugitha_N
Moderator
Moderator
Moderator
25 likes received 250 replies posted 100 solutions authored

Hi LucaH,

1. Host does not have the access to change all parameters in the example file because some parameters are written to the XMC board. These parameters can only be changed in config.h file present in the DAVE Project. After configuring parameters build the DAVE Project and flash the new hex file created to the board. 

2. In  max_distance_m_lower_boundary, lower_boundary or upper_boundary are  actually referred as the range bin boundaries. The maximum range is divided into certain number of range bins. For example, if the maximum range is 5m and number of range bins are 64. So, each range bin=5/64=0.078125m = 7.81cm. If there is a target at 1m, the radar might check between the range bins 11 to 13. 

3. Please ensure after changing parameters, first apply it and then use make persistent option. 

4. Distance2GoL comes with 80 degree/29 degree field of view(FOV). Can you please brief me about the  reception angle which your speaking about?

Thanks and regards,

Narra Pugitha.

0 Likes
Pugitha_N
Moderator
Moderator
Moderator
25 likes received 250 replies posted 100 solutions authored

Hi @LucaH 

Hope your query is resolved.

We are closing this thread due to inactivity. Please create a new thread for further queries.

Thanks and regards,

Pugitha.

0 Likes