AEM infinity CAN BUS data

Discussion on the Lua Scripting capabilities for RaceCapture/Pro. Also see the <a href="http://autosportlabs.net/RaceCapturePro_Lua_Scripting">Lua Scripting Guide</a>

Moderators: JeffC, stieg

roostinds
Posts: 11
Joined: Wed Sep 09, 2015 3:52 am
Location: Los Angeles Ca

Post by roostinds »

So I cleared everything and put the script in and now I get this message:

&#65279;running lua script len(1455)...lua: startup script error: ([string "startup"]:13.0: malformed number near '00a0')
done

madjak
Posts: 29
Joined: Mon Jul 13, 2015 7:40 am

Post by madjak »

Can you please copy everything out of the script window and post it here. There is an error on line 13 of the script.

roostinds
Posts: 11
Joined: Wed Sep 09, 2015 3:52 am
Location: Los Angeles Ca

Post by roostinds »

SO i got it to work but not all channels are displaying. I have attached the script and the can bus data log. Also, how do i pull the RPM data for the shiftx script. I see everyone using getRPMtimer but i am assuming everyone is tapping the Tach wire where i am pulling it from CAN.. Thanks.
Attachments
config 091315.txt
(2.92 KiB) Downloaded 123 times
091315.txt
(37.99 KiB) Downloaded 128 times

madjak
Posts: 29
Joined: Mon Jul 13, 2015 7:40 am

Post by madjak »

you probably need someone else to help out regarding debugging the CAN log, however I can see no "32546819" values in the stream. Either you don't have an o2 sensor hooked up or that value is streaming out somewhere on another value.

Also there are three "32546820.0" values in a row with different data. I'm not sure why but I think something is getting confused.

Actually looking at the data the first "32546820.0" value is actually the 32546819.0 one as it ends with 220 and 96 bits (which is 13.8 volts .. 220x256 + 96 = 13.8)

The second "32546820.0" value is the actual "32546820.0" data which contains the map, fps ,ops.

The third is only present sometimes which means it's being output at a lower frequency. It doesn't look like it contains any data except the last.

One last thing is the data is all even values... I suspect there is a rounding issue given the values are so high. You need to email the guys to see if there is something they can fix at their end.

brentp
Site Admin
Posts: 6274
Joined: Wed Jan 24, 2007 6:36 am

Post by brentp »

Hi,

Sorry I missed this.

madjak, thanks for your analysis. I think there might be something to investigate in the firmware where we might be dropping the bit on 29 bit CAN messages.

First thing I'll focus on is sending messages in loopback - from CAN 2 to CAN 1 to see if we're mis-reading the CAN ID when it's incoming.
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

roostinds
Posts: 11
Joined: Wed Sep 09, 2015 3:52 am
Location: Los Angeles Ca

Post by roostinds »

Any Progress on this??

brentp
Site Admin
Posts: 6274
Joined: Wed Jan 24, 2007 6:36 am

Post by brentp »

We're still looking at it. Currently our approach is to send CAN data from one RCP to another, verifying whether or not the CAN id's are sent correctly.

We'll keep this thread posted as we find out more.
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

madjak
Posts: 29
Joined: Mon Jul 13, 2015 7:40 am

Post by madjak »

you could probably program a work around by detecting if there a zero values in the data that correspond to set unique locations in the data chain.

32546820.0, 129.0, 0.0, 0.0, 0.0, 5.0, 48.0, 220.0, 96.0,
32546820.0, 3.0, 185.0, 0.0, 3.0, 3.0, 0.0, 0.0, 8.0,
32546820.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 10.0,

So if the first value = 0 then discard, it's not required
Then if the second value = 0 the data 32546820.0, 129.0, 0.0, 0.0, 0.0, 5.0, 48.0, 220.0, 96.0 is the 32546819 data, if not then 32546820.0, 3.0, 185.0, 0.0, 3.0, 3.0, 0.0, 0.0, 8.0 is 32546820.

So something like this:

Code: Select all

CAN_map = &#123; 
&#91;32546816&#93; = function&#40;data&#41; 
  map_chan&#40;rpmId, data, 0, 2, 0.39063, 0&#41; 
  map_chan&#40;tpsId, data, 4, 2, 0.0015259, 0&#41; 
  map_chan&#40;atsId, data, 6, 1, 1.8, 32&#41; 
  map_chan&#40;ctsId, data, 7, 1, 1.8, 32&#41; 
end, 
&#91;32546820&#93; = function&#40;data&#41;
  if data&#91;0&#93; ~= 0 then
    if data&#91;1&#93; == 0 then
      --run data &#40;its 32546819&#41;
      map_chan&#40;afrId, data, 1, 1, 0.057227, 7.325&#41;
    else
      --run data &#40;its 32546820&#41;
      map_chan&#40;mapId, data, 0, 2, 0.014504, -14.6960&#41; 
      map_chan&#40;fpsId, data, 3, 1, 0.580151, 0&#41; 
      map_chan&#40;opsId, data, 4, 1, 0.580151, 0&#41;
    end
  else
    --drop data &#40;its the third line&#41;
  end
end
&#125;
Bit nasty but it's at least one way to work around the issue.

brentp
Site Admin
Posts: 6274
Joined: Wed Jan 24, 2007 6:36 am

Post by brentp »

Hi,

We have a planned fix that will show up in the 2.8.6 release. Hang tight!
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

Post Reply