Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

XNET CAN filtering based on payload information of different frames

Dear all,

 

The CAN frames I recieve per cycle are with the following identifiers: 

 

[1 frame] 513 (Radar status- range, elevation, target type)

[1 frame]1536 (Target status - No of targets near field from byte 1 and No of targets far field from byte 2)

 

Followed by 96 message pairs of which 1-32 pairs are for near field and 33-96 are for far field.

1793 (Target Info 1)

1794 (Target Info 2)

 

For the filter, I need to to identify the 1536 frame first and read byte 1 and byte 2 which gives me information about the number near and far targets respectively. 

Then I need to pick (equal to byte1) number of message pairs from the first 32 pairs and retrieve sigals from that; and then pick (equal to byte2) number of message pairs from then next 64 message pairs and retrive signals. 

 

As this plots only the targets that are valuable. I am also looking to create more efficient projects that can be scaled to multiple radars. Any tips for efficient documentation would be much appreciated.

 

 

 

Kind Regards,

Red

 

 

 

 

Download All
0 Kudos
Message 1 of 10
(7,353 Views)

Dear all,

 

I have tried to use filters to take out the first frame [1536] and then isloate the first number using Index array and string to number functions. But I do not know how to split up the 96CAN frames  pairsinto 32 and 64 and then plot the signals. 

 

I need to make a new version which plots only what is useful data. Suppose there are 10 Near field targets located, it has to be taken from the first 10 message pairs and the rest discarded as it is not useful.

 

I can get the payload message but not able to split it further. 

 

 

Please help me with it. 

Thanks in advance. 

0 Kudos
Message 2 of 10
(7,332 Views)

Hello Red,

 

Check this Snippet. you need to use array function to split your Frame Data.

 

CAN Frames Reading.png

Munna
0 Kudos
Message 3 of 10
(7,309 Views)

Hey munna,

 

Thank you for the snippet. It follows the logic I had in mind. 

I incorporated it into the main code but it seems to hang and the whole VI closes. 

Cannot figure out what is wrong with it. 

0 Kudos
Message 4 of 10
(7,286 Views)

Hello Red,

 

I saw your code. you need do some modifications.

 

1. your using STOP vi in ForLoop. when it's true then it will stop your main VI completely. It's like abort button. Instead of that right click on forloop and select Stop terminal.

2. your passing two index arrays to Forloop (CAN Frames & Search ID Array). if your giving like this, it will always executes based on least array index. So suppose you have 100 frames then it will runs up to 7 times (because your array have 7 elements)

3. why are taking index from foorloop and again using other loop with Shift registers?  you can take last value directly from your 1st FoorLoop. Right click on the Tunnel and Select Last element.

4. In your VI, your always clearing your XNET reference. Suppose CAN Frame is not present in next iteration then it wont take previous value. it will give you default value (max- 0)

 

 

Munna
0 Kudos
Message 5 of 10
(7,281 Views)

Dear Munna, 

 

I have checked all points except the second point were I am using for loops for CAN frames. 

The code is yet hanging and not giving a chance to run/debug.

 

 

Please look into the code one more time. 

 

 

Kind regards,

Red

0 Kudos
Message 6 of 10
(7,242 Views)

Hello Red,

 

Please check the attached code.

 

let me know if need any other information.

Munna
0 Kudos
Message 7 of 10
(7,235 Views)

A lot of connections had been disconnected to the property nodes. I could not run before fixing them.

 

I believe that the due to invoking two Xnet convert session maybe hanging the code. 

 

 

0 Kudos
Message 8 of 10
(7,220 Views)

If I had to startover, to read CAN frames from the bus, log them to file, analyse and process signals for plotting complex radar image plots and scale the code for 5 radars.

 

How do I go about making a project (Optimizing the code) ?

How do I eliminate unnecessary loops while debugging the code. As now it just hangs and I can't figure out why it is going wrong.

 

 

Regards,

Gagan

0 Kudos
Message 9 of 10
(7,219 Views)

Hello Red,

 

Sorry to say, Check it by yourself. I think you’re the best person to judge your code with requirement.

If your facing any problem then please Post. You will get different Ideas/solutions from many people.

Munna
0 Kudos
Message 10 of 10
(7,202 Views)