Page 1 of 6

MK2 no NMEA data

Posted: Sat Oct 29, 2016 1:15 am
by MrBlah
New problem, I just got my mk2 back from autosports labs and now I'm not getting gps data

the racecapture app shows it has signal

Image

Image

Image

Re: MK2 no NMEA data

Posted: Sat Oct 29, 2016 3:18 am
by MrBlah
honestly I never tried this before, is this working as its supposed to? I tried to use the performance 0-60 part of the app and it wont log any speed, never got it to trigger

Re: MK2 no NMEA data

Posted: Sat Oct 29, 2016 4:34 am
by gplracerx
You don't have the RC app running at the same time as HLT do you?

Re: MK2 no NMEA data

Posted: Sat Oct 29, 2016 8:16 am
by Harry
The RCP does not deliver a NMEA stream but its own protocol. This in turn does not support satellite almanac information as shown in Satellites view.

Harry

Re: MK2 no NMEA data

Posted: Sat Oct 29, 2016 12:51 pm
by MrBlah
Any ok, does this affect the new performance app too? I could not get it to show speed

Re: MK2 no NMEA data

Posted: Sat Oct 29, 2016 1:00 pm
by Harry
No, speed is certainly collected from RCP. In case OBD / wheel speed is available, Dyno will use it. Otherwise GPS speed will be used. For the RCP, please make sure you have the channels configured correctly. Check both GPS and OBD speed channels in ASL's tooling. Next, connect it to Buddy or LapTimer and verify you get speed data (GPS or Engine View). In case you get no speed, the RCP configuration is not o.k.

- Harry

Re: MK2 no NMEA data

Posted: Sat Oct 29, 2016 1:35 pm
by MrBlah
what is "ASL's tooling" the racecapture app? I'm using LUA to map canbus data

my obd/wheel speed is gonna be way way off, due to my tiny tires for autocross

lfWheelId = addChannel("LFWheelSpd", 10, 0, 0, 200, "MPH")
rfWheelId = addChannel("RFWheelSpd", 10, 0, 0, 200, "MPH")
lrWheelId = addChannel("LRWheelSpd", 10, 0, 0, 200, "MPH")
rrWheelId = addChannel("RRWheelSpd", 10, 0, 0, 200, "MPH")


[496] = function(data) processWheel(lfWheelId, data, 0)
processWheel(rfWheelId, data, 2)
processWheel(lrWheelId, data, 4)
processWheel(rrWheelId, data, 6)

Re: MK2 no NMEA data

Posted: Sat Oct 29, 2016 1:54 pm
by MrBlah
here is the full script I use, from the wiki

--This example configured for Mini Cooper CAN
-- Automatically starts logging with engine 'on' (RPM triggered)
--how frequently we poll for CAN messages
tickRate = 30
--the CAN baud rate
CAN_baud = 500000
--CAN channel to listen on. 0=first CAN channel, 1=second
CAN_chan = 0

--add your virtual channels here
--format addChannel(<name>, <sample rate>, <precision>, <min>, <max>, [units])
tpsId = addChannel("TPS", 10, 0, 0, 100, "%")
tempId = addChannel("EngineTemp", 1, 0, 0, 255, "F")
oilTempId = addChannel("OilTemp", 1, 0, 0, 255, "F")
rpmId = addChannel("RPM", 10, 0, 0, 10000)
steerId = addChannel("Steering", 10, 0, -360, 360, "Deg.")
brakeId = addChannel("BrakeSw", 10, 0, 0, 1)
brakePressId = addChannel("Brake", 10, 0, 0, 255, "Bar")
clutchId = addChannel("Clutch", 10, 0, 0, 1)
lfWheelId = addChannel("LFWheelSpd", 10, 0, 0, 200, "MPH")
rfWheelId = addChannel("RFWheelSpd", 10, 0, 0, 200, "MPH")
lrWheelId = addChannel("LRWheelSpd", 10, 0, 0, 200, "MPH")
rrWheelId = addChannel("RRWheelSpd", 10, 0, 0, 200, "MPH")
gearTempId = addChannel("GearboxTmp", 10, 0, 0, 400, "F")
fuelId = addChannel("Fuel", 1, 0, 0, 100, "%")
extTempId = addChannel("ExtTemp", 1, 0, 0, 120,"F")

--Convert C to F
function toF(value)
return value * 1.8 + 32
end

--TPS, correct your throttle here for true 100%
function tpsFilter(value)
return value + 0.0
end

--only start logging / telemetry if engine is running
function rpmFilter(value)
if value > 500 then startLogging() else stopLogging() end
return value
end

function brakeFilter(value)
return bit.rshift(bit.band(value, 0x10), 4)
end

function clutchFilter(value)
return bit.band(value, 0x01)
end

function processWheel(id, data, offset)
--wheel speed is 13 bits long, little endian
--low byte high byte
--76543210 76543210
--11111111 11111XXX
local highByte = bit.band(data[offset + 2], 0x1F)
local lowByte = data[offset + 1]
local value = highByte * 256 + lowByte
value = value * 0.0625
--convert to MPH. comment to keep KPH
value = value * 0.621371
setChannel(id, value)
end

function processSteering(data)
local steer = 0
if data[2] > 127 then
steer = -1*(((data[2]-128)*256)+data[1])
else
steer = (data[2]*256)+data[1]
end
setChannel(steerId, (steer*0.045))
end

function fuelFilter(value)
--adjust for 7 bit value
value = bit.band(value, 0x7F)
--convert liters to %
return value / 0.48
end

function extTempFilter(value)
local temp = bit.band(value, 0x7F)
if value > 127 then
temp = -1 * temp
end
temp = toF(temp)
return temp
end

----------------------------------------
--customize here for CAN channel mapping
--format is:
--[CAN Id] = function(data) map_chan(<chan_id>, <data>, <CAN offset>, <CAN length>, <multiplier>,
-- <adder>, [filter])
----------------------------------------
CAN_map = {
[496] = function(data) processWheel(lfWheelId, data, 0)
processWheel(rfWheelId, data, 2)
processWheel(lrWheelId, data, 4)
processWheel(rrWheelId, data, 6)
end,
[339] = function(data) map_chan(brakeId, data, 0, 1, 1, 0, brakeFilter) end,
[504] = function(data) map_chan(brakePressId, data, 2, 1, 1, 0) end,
[809] = function(data) map_chan(tpsId, data, 5, 1 , 0.392156863, 0, tpsFilter)
map_chan(tempId, data, 1, 1, 0.75, -48, toF)
map_chan(clutchId, data, 3, 1, 1, 0, clutchFilter)
end,
[1349] = function(data) map_chan(oilTempId, data, 4, 1, 1, -48, toF) end,
[1083] = function(data) map_chan(gearTempId, data, 0, 1, 1, -55, toF) end,
[790] = function(data) map_chan(rpmId, data, 2, 2, 0.15625, 0, rpmFilter) end,
[501] = function (data) processSteering(data) end,
[1555] = function (data) map_chan(fuelId, data, 2, 1, 1, 0, fuelFilter) end,
[1557] = function (data) map_chan(extTempId, data, 3, 1, 1, 0, extTempFilter) end
}

function onTick()
processCAN(CAN_chan)
end
--===========do not edit below===========
function processCAN(chan)
local msg = 0
repeat
local id, e, data = rxCAN(chan, 0)
if id ~= nil then
local map = CAN_map[id]
if map ~= nil then
map(data)
end
end
msg = msg + 1
until id == nil or msg > 100
end

--Map CAN channel, little endian format
function map_chan(cid, data, offset, len, mult, add, filter)
if offset + len > #data then return end
offset = offset + 1
local value = 0
local shift = 1
while len > 0 do
value = value + (data[offset] * shift)
shift = shift * 256
offset = offset + 1
len = len - 1
end
local cv = value * mult + add
if filter ~= nil then cv = filter(cv) end
setChannel(cid, cv)
end
initCAN(CAN_chan, CAN_baud)
setTickRate(tickRate)

Re: MK2 no NMEA data

Posted: Sat Oct 29, 2016 2:25 pm
by MrBlah
I forgot to mention, rpm, tps, oil and water temp all seem to be working, but wheel speed is not I'm not seeing speed when I drive the car

Re: MK2 no NMEA data

Posted: Sat Oct 29, 2016 2:32 pm
by Harry
I see you are deep down in customizing your RCP :-)

Looking into LapTimer's code, the speed channel needs to come with name "Speed". The unit needs to be either "MPH" or "". In case it is "MPH", the channel is interpreted as GPS speed in mph, and in case it is empty, it is interpreted as wheel speed in km/h. The unit part is an ugly tweak based on ASL's default channel definition. Actually it would be better to have some qualified speed channel naming like "GPSSpeed" and "WheelSpeed".

So please check if you have configured a channel with "Speed".

- Harry