It looks like you're new here. If you want to get involved, click one of these buttons!
local background = Bitmap.new(Texture.new("compass-background.png")) strilka = Bitmap.new(Texture.new("compass-pointer.png", true)) strilka:setAnchorPoint(0.5, 0.5) stage:addChild(background) stage:addChild(strilka) background:setPosition(10, 40) strilka:setPosition(160, 210) geolocation = Geolocation.new() local filter =0.03 magnetic=0 local function onHeadingUpdate(event) magnetic=event.magneticHeading mn=magnetic*filter+mn * (1-filter) -- An error occurs here !!!!!!!!!!!!!! --Each time you restart, the direction of the scale changes randomly (by time - versus time) strilka:setRotation(-mn) --strilka:setRotation(mn) end geolocation:addEventListener(Event.HEADING_UPDATE, onHeadingUpdate) geolocation:start() |
Comments
To calibrate the compass we turn the phone to form a 8 shape.
I don't know if it's related to your question.
I have another problem - the compass is confusing west and east
Think this is a error in gideros
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
I only use a magnetic sensor
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
float x = event.values[0];
float y = event.values[1];
float z = event.values[2];
I want to use another formula instead:
double magneticHeading = (Math.atan2(x, -y) + Math.PI) * (180 / Math.PI);
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
And with additional data I can directly process the sensor data
Now a number sign is confused on one axis.And in the accelerometer, too, along one axis, the number sign is tangled,
Don't change anything in Gsderos but just add to event event.magneticHeading events on axes event.X, event.Y event.Z
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
Likes: oleg
Likes: oleg
Likes: antix
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!