You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Tuur

Sage

  • "Tuur" started this thread

Posts: 3,769

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

1

Wednesday, September 26th 2012, 2:34pm

strange compass problems

Hi,

i have sort of strange and difficult compass / map / aircompass / heading problem.
i try to explain.

I made a barebone example ONLY FOR IPAD:

http://www.virtualtuur.com/krpano/compasstest2/

so have a look, 3 pano's, radar on map is correct!
aircompass is pointing to the right, real world, north in the first pano. But the photo is off. It points to hlookat 0.


So... The photo and radar are right, to each other. The compass and aircompss are right to the real world.
Easy you just say? Inthe next photo the deviation is different because of the zero of the photo.
When i change heading, the radar is off...


when i put 'header 180' the north on aircompass is right (real north) but not in the pano and radar. it's off.

i played with numbers but can't get it.
Also for the next pano's ths problem is even worse (same).

So the north of the compass is not the 'north' (hlookat 0) of the photo.
- when i put aircompass to the right point (north) in the photo, the absolute north is off
- when i put aircompass to the right realworld north, the photo is off

-so is there a deviation option in the compass plugin?
-or how can i set a new header for each photo? (not sure if that makes sence)
-can i change the photo hlookat just for aircompass. So aircompass thinks it's 0?

as i didn't stitch with the north in the center these problems occure.

problem 2 :

when you put compass button and gyro button, so that they are both of. Then activate the gyro. all is fine.. but when you activate compass the gyro stops...


edit;
now i put the radar and the aircompass and the pano in the rigth possition. But still the compass.js takes a real north.

here full code:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<krpano logkey="true" onstart="startup();map_vars();" >

	<include url="vtourskin.xml" />
	<include url="actions_move_mobile.xml" />
	<include url="map.xml" />
	<include url="vars.xml" />
	<include url="compass.xml" />
	
	
	



	<action name="startup">
		if(startscene === null, copy(startscene,scene[0].name));
		loadscene(get(startscene), null, MERGE);

	</action>

	
	<scene name="scene_huis_1" title="1" onstart="setmapspots();" thumburl="panos/huis_1.tiles/thumb.jpg" heading="55">

		<view hlookat="0" vlookat="0" fovtype="MFOV" fov="70" maxpixelzoom="2.0" fovmin="30" fovmax="120" limitview="auto" />
	<include url="aircompass/aircompass.xml" />
		<preview url="../../../vosbergen/mobile/panos/huis_1.tiles/preview.jpg" />

		<image>
			<cube url="../../../vosbergen/mobile/panos/huis_1.tiles/pano_%s.jpg" />
			<mobile>
				<cube url="../../../vosbergen/mobile/panos/huis_1.tiles/mobile_%s.jpg" />
			</mobile>
		</image>
		
	  <hotspot name="hs1" style="skin_hotspotstyle_black" ath="35.821" atv="6.382" linkedscene="scene_vos_2"  />


	</scene>
	
	

	<scene name="scene_vos_2" title="2" onstart="setmapspots();" thumburl="panos/vos_2.tiles/thumb.jpg" lat="" lng="" heading="">

		<view hlookat="0" vlookat="0" fovtype="MFOV" fov="70" maxpixelzoom="2.0" fovmin="30" fovmax="120" limitview="auto" />
	<include url="aircompass/aircompass.xml" />
		<preview url="../../../vosbergen/mobile/panos/vos_2.tiles/preview.jpg" />

		<image>
			<cube url="../../../vosbergen/mobile/panos/vos_2.tiles/pano_%s.jpg" />
			<mobile>
				<cube url="../../../vosbergen/mobile/panos/vos_2.tiles/mobile_%s.jpg" />
			</mobile>
		</image>


	  <hotspot name="hs2" style="skin_hotspotstyle_black" ath="0.5567018186254984" atv="15.731434768064597" linkedscene="scene_huis_1"  />
	  <hotspot name="hs2_2" style="skin_hotspotstyle_black" ath="180" atv="15.731434768064597" linkedscene="scene_vos_3"   />

	</scene>

	<scene name="scene_vos_3" title="3" onstart="setmapspots();" thumburl="panos/vos_3.tiles/thumb.jpg" lat="" lng="" heading="">

		<view hlookat="0" vlookat="0" fovtype="MFOV" fov="70" maxpixelzoom="2.0" fovmin="30" fovmax="120" limitview="auto" />
	<include url="aircompass/aircompass.xml" />
		<preview url="../../../vosbergen/mobile/panos/vos_3.tiles/preview.jpg" />

		<image>
			<cube url="../../../vosbergen/mobile/panos/vos_3.tiles/pano_%s.jpg" />
			<mobile>
				<cube url="../../../vosbergen/mobile/panos/vos_3.tiles/mobile_%s.jpg" />
			</mobile>
		</image>
		
	  <hotspot name="hs3_2" style="skin_hotspotstyle_black" ath="-1.1425375474639026" atv="13" linkedscene="scene_vos_2"  />
		


	</scene>

	 <include url="aircompass/aircompass.xml" />
	



<plugin name="skin_gyro" 
        url="../skin/plugins/gyro.js" 
        keep="true"
        enabled="true"
        camroll="true"
        friction="0.5"
        velastic="0"
		devices="mobile|tablet"
       />

<plugin name="compass" devices="html5"
        url="../skin/plugins/compass.js"
		compassenabled="true"
		keep="true"
		heading="50"
        onavailability="if(compassenabled == true, copy(view.hlookat, heading););"
		onchange="if(compassenabled == true, copy(view.hlookat, heading););"
		    />
	
<evens name="compass" keep="true" onnewpano="if(plugin[compass].available, copy(view.hlookat, heading));" />



<style name="spot_style" url="../skin/buttons/mappoint2.png" keep="true" zorder="50" />



<action name="setmapspots">
	map_vars();
			
	txtadd(mapsptsx, '_spot', get(scene[get(xml.scene)].title), 'x');
		copy(mapsptsx, get(mapsptsx));
	txtadd(mapsptsy, '_spot', get(scene[get(xml.scene)].title), 'y');
		copy(mapsptsy, get(mapsptsy));
	txtadd(mapsptsh, '_spot', get(scene[get(xml.scene)].title), 'h');
		copy(mapsptsh, get(mapsptsh));
		
	set(plugin[spotx].x, get(mapsptsx));
	set(plugin[spotx].y, get(mapsptsy));
	
	add(mapsptsxm, mapsptsx,7);
	add(mapsptsym, mapsptsy,7);
	
	set(plugin[radar].x, get(mapsptsxm));
	set(plugin[radar].y, get(mapsptsym));
	set(plugin[radar].heading, get(mapsptsh));
	
	
</action>

<layer name="map" url="../skin/buttons/map_sat.png" scale="0.5" keep="true" align="lefttop" x="10" y="10" visible="true"  >

	<layer name="radar" url="../skin/plugins/radar.js"  parent="map" zorder="5" origin="lefttop" edge="center" keep="true"  scale="1.8"  x="get(_spot1x);" y="get(_spot1y);" width="80" height="80"  linewidth="2"   fillalpha="0.5" fillcolor="0x000000" />


	<layer name="spotx" url="../skin/buttons/mappointactive3.png" parent="map"  visible="true"  keep="true"   zorder="100" origin="lefttop"   x="get(_spot1x);" y="get(_spot1y);"  />


	<layer name="spot1"  style="spot_style"  x="get(_spot1x)" y="get(_spot1x)"  onclick="loadscene(scene_huis_1),null,MERGE,BLEND(1));" onloaded="set(x,get(_spot1x));set(y,get(_spot1y));" />
	<layer name="spot2"  style="spot_style"  x="get(_spot2x)" y="get(_spot2x)"  onclick="loadscene(scene_vos_2),null,MERGE,BLEND(1));" onloaded="set(x,get(_spot2x));set(y,get(_spot2y));" />
	<layer name="spot3"  style="spot_style"  x="get(_spot3x)" y="get(_spot3x)"  onclick="loadscene(scene_vos_3),null,MERGE,BLEND(1));" onloaded="set(x,get(_spot3x));set(y,get(_spot3y));" />


</layer>

<action name="map_vars">

	set(_spot1x, 212);
	set(_spot1y, 149);
	set(_spot1h, 198);

	set(_spot2x, 180);
	set(_spot2y, 146);
	set(_spot2h, 20);

	set(_spot3x, 160);
	set(_spot3y, 138);
	set(_spot3h, 15);

</action>	

	<progress showload="none" showwait="none" />



	<!-- Skin Layout -->
	

		<layer name="skin_btn_compass" url="../skin/buttons/btn_compass.png" keep="true" align="bottom" devices="HTML5" visible="true"  x="-100"    scale="0.5" ondown="if(plugin[compass].compassenabled == true, set(plugin[compass].compassenabled,false);set(plugin[skin_gyro].enabled,false);, set(plugin[compass].compassenabled,true);set(plugin[skin_gyro].enabled,true); );" />

		<layer name="skin_btn_gyro"   url="../skin/buttons/btn_gyro.png" keep="true"  align="bottom"   visible="true" devices="HTML5"   x="140"     scale="0.5" ondown="switch(plugin[skin_gyro].enabled);"   />

		


	<!-- Skin Hotspot Style (the hotspots need a 'linkedscene' attribute to be clickable)-->

	<style name="skin_hotspotstyle_black" url="../skin/buttons/htsp_black.png" id="hotsp" alpha="0.6" scale="1" edge="top" oy="0" zoom="false" distorted="true" onclick="  setmovevar(); if(linkedscene, tween(scale,0.25,0.5); tween(oy,-50,0.5); tween(alpha,0,0.5,,WAIT); tween(view.vlookat,0,0.5, easeOutQuad); tween(view.fov,40,0.5, easeOutQuad); wait(1); loadscene(get(linkedscene),null,MERGE,BLEND(1));   ); wait(0.3); getmovevar();  " />

    <action name="lookinterrupt">
    	breakall();	
    </action>


<action name="setmovevar">
	set(_movevar, get(scene[get(xml.scene)].title));
		
</action>	

<action name="getmovevar">
	set(_newmovevar, get(scene[get(xml.scene)].title));

	if(_movevar == 1,  
		if(_newmovevar == 2, lookat(0,0);wait(1);oninterrupt( action(lookinterrupt) );lookto(180,0,70,smooth(25,25,25)); );
	);

	if(_movevar == 2,  
		if(_newmovevar == 1, lookat(20,0);wait(1);oninterrupt( action(lookinterrupt) );lookto(270,0,70,smooth(25,25,25)); );
		if(_newmovevar == 3, lookat(0,0);wait(1);oninterrupt( action(lookinterrupt) );lookto(270,0,70,smooth(25,25,25)); );
	);

	if(_movevar == 3,  
		if(_newmovevar == 2, lookat(180,0);wait(1);oninterrupt( action(lookinterrupt) );lookto(0,0,70,smooth(25,25,25)); );
	);

	
</action>	


</krpano>


Tuur *thumbsup*

This post has been edited 6 times, last edit by "Tuur" (Sep 27th 2012, 3:28am)


Tuur

Sage

  • "Tuur" started this thread

Posts: 3,769

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

2

Thursday, September 27th 2012, 3:24am

ok really barebone

http://www.virtualtuur.com/krpano/compasstest3/

pano, radar and aircompass are right.
How to synchronise with real world north?
compass.js

*confused*

Full code:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<krpano logkey="true" onstart="startup();" >

 <include url="aircompass/aircompass.xml" />

	<action name="startup">
		if(startscene === null, copy(startscene,scene[0].name));
		loadscene(get(startscene), null, MERGE);

	</action>

	
	<scene name="scene_huis_1" title="1" onstart="" thumburl="panos/huis_1.tiles/thumb.jpg" heading="">

		<view hlookat="0" vlookat="0" fovtype="MFOV" fov="70" maxpixelzoom="2.0" fovmin="30" fovmax="120" limitview="auto" />
	<include url="aircompass/aircompass.xml" />
		<preview url="../../../vosbergen/mobile/panos/huis_1.tiles/preview.jpg" />

		<image>
			<cube url="../../../vosbergen/mobile/panos/huis_1.tiles/pano_%s.jpg" />
			<mobile>
				<cube url="../../../vosbergen/mobile/panos/huis_1.tiles/mobile_%s.jpg" />
			</mobile>
		</image>
		
	</scene>
	

<plugin name="skin_gyro" 
        url="../skin/plugins/gyro.js" 
        keep="true"
        enabled="true"
        camroll="true"
        friction="0.5"
        velastic="0"
		devices="mobile|tablet"
       />

<plugin name="compass" devices="html5"
        url="../skin/plugins/compass.js"
		compassenabled="true"
		keep="true"
        onavailability="if(compassenabled == true, copy(view.hlookat, heading););"
		onchange="if(compassenabled == true, copy(view.hlookat, heading););"
		    />
	
<evens name="compass" keep="true" onnewpano="if(plugin[compass].available, copy(view.hlookat, heading));" />

<!-- map stuff -->

<style name="spot_style" url="../skin/buttons/mappoint2.png" keep="true" zorder="50" />


<layer name="map" url="../skin/buttons/map_sat.png" scale="0.5" keep="true" align="lefttop" x="10" y="10" visible="true"  >

	<layer name="radar" url="../skin/plugins/radar.js"  parent="map" zorder="5" origin="lefttop" edge="center" keep="true"  scale="1.8"  x="217" y="155" heading="198" width="80" height="80"  linewidth="2"   fillalpha="0.5" fillcolor="0x000000" />


	<layer name="spotx" url="../skin/buttons/mappointactive3.png" parent="map"  visible="true"  keep="true"   zorder="100" origin="lefttop"   x="212" y="149"  />


	<layer name="spot1"  style="spot_style"  x="212" y="149"  onclick="loadscene(scene_huis_1),null,MERGE,BLEND(1));"  />


</layer>

<!-- buttons to show the problem of: when put off gyro and compass. Then put on gyro and when you change to compass gyro goes off..  -->

		<layer name="skin_btn_compass" url="../skin/buttons/btn_compass.png" keep="true" align="bottom" devices="HTML5" visible="true"  x="-100"    scale="0.5" ondown="if(plugin[compass].compassenabled == true, set(plugin[compass].compassenabled,false);set(plugin[skin_gyro].enabled,false);, set(plugin[compass].compassenabled,true);set(plugin[skin_gyro].enabled,true); );" />

		<layer name="skin_btn_gyro"   url="../skin/buttons/btn_gyro.png" keep="true"  align="bottom"   visible="true" devices="HTML5"   x="140"     scale="0.5" ondown="switch(plugin[skin_gyro].enabled);"   />
 

</krpano>



here you can see:
radar and aircompas in combination with real north are ok. But the photo not..north is on like 55 degrees..

http://www.virtualtuur.com/krpano/compasstest4/

EDIT: I changed. radar, aircompass and photo are ok, but compass.js is 'off' (or the only one true.
So both options (routes of settings) are not compatible. *unsure* *confused* *wacko*


Tuur *cry*

This post has been edited 5 times, last edit by "Tuur" (Sep 27th 2012, 2:45pm)


3

Thursday, September 27th 2012, 5:37am

I have strange problems, too.

This is not a related topic, but I have strange problems, too.
I have tested the folowing code, and works very well in a just single pano.
However, I can't understand why this does not work at multiple .


<events name="aircompass" onviewchange="rotatecompass();" keep="true" />

<hotspot name="fb" url="skin/fb.png" alpha="0.5" keep="ture" distorted="true" ath="0" atv="0" rx="0" ry="0" zorder="10" />
<hotspot name="rl" url="skin/rl.png" alpha="0.5" keep="ture" distorted="true" ath="0" atv="0" rx="0" ry="0" zorder="10" />
<hotspot name="ho" url="skin/ho.png" alpha="0.5" keep="ture" distorted="true" ath="0" atv="0" rx="0" ry="0" zorder="10" />

<action name="rotatecompass">
sub(hfbang,0,get(view.hlookat));
set(hotspot[fb].ath,get(view.hlookat));
set(hotspot[fb].atv,get(view.vlookat));
set(hotspot[fb].rx,get(view.vlookat));
set(hotspot[fb].ry,get(hfbang));

sub(hrlang,90,get(view.hlookat));
set(hotspot[rl].ath,get(view.hlookat));
set(hotspot[rl].atv,get(view.vlookat));
set(hotspot[rl].rx,get(view.vlookat));
set(hotspot[rl].ry,get(hrlang));

add(vhoang,-90,get(view.vlookat));
set(hotspot[ho].ath,get(view.hlookat));
set(hotspot[ho].atv,get(view.vlookat));
set(hotspot[ho].rx,get(vhoang));
</action>
I can't rememeber, but I have encountered similar situations several times.
Are the environment different when a new scene has been loaded?

Min

Tuur

Sage

  • "Tuur" started this thread

Posts: 3,769

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

4

Friday, September 28th 2012, 7:37pm

SOLVED!

My problem is solved.

now i have a new one.

When i use aircompass in a tour, i have to include the aircompass.xml in every scene what makes the loading very slow..
67 scenes

is there an other way?

Tuur *thumbsup*

5

Saturday, September 29th 2012, 11:58am

Hi

set all keep true and update on each scene like you make for map or bing ;-)

Similar threads