<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ArcGisARView with compass not point to nord in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/arcgisarview-with-compass-not-point-to-nord/m-p/1241019#M5932</link>
    <description>&lt;P&gt;I found a solution by creating a custom LocationDatasource and making a method to manage what I have received onSensorChanged:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;override fun &lt;/SPAN&gt;&lt;SPAN&gt;onSensorChanged&lt;/SPAN&gt;(event: SensorEvent) {&lt;BR /&gt;    &lt;SPAN&gt;val &lt;/SPAN&gt;type = event.sensor.type&lt;BR /&gt;    &lt;SPAN&gt;if &lt;/SPAN&gt;(type == Sensor.TYPE_ACCELEROMETER) {&lt;BR /&gt;        gravity = lowPassFilter(event.values.clone()&lt;SPAN&gt;, &lt;/SPAN&gt;gravity)&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;    &lt;SPAN&gt;if &lt;/SPAN&gt;(type == Sensor.TYPE_MAGNETIC_FIELD) {&lt;BR /&gt;        geomagnetic = lowPassFilter(event.values.clone()&lt;SPAN&gt;, &lt;/SPAN&gt;geomagnetic)&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;    &lt;SPAN&gt;if&lt;/SPAN&gt;(type == Sensor.TYPE_ROTATION_VECTOR)&lt;BR /&gt;    {&lt;BR /&gt;        &lt;SPAN&gt;val &lt;/SPAN&gt;currentRotation = event.values&lt;BR /&gt;        &lt;SPAN&gt;val &lt;/SPAN&gt;rotationMatrix = FloatArray(&lt;SPAN&gt;9&lt;/SPAN&gt;)&lt;BR /&gt;        SensorManager.getRotationMatrixFromVector(rotationMatrix&lt;SPAN&gt;, &lt;/SPAN&gt;currentRotation)&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;    &lt;SPAN&gt;if&lt;/SPAN&gt;(gravity != &lt;SPAN&gt;null &lt;/SPAN&gt;&amp;amp;&amp;amp; geomagnetic != &lt;SPAN&gt;null&lt;/SPAN&gt;)&lt;BR /&gt;    {&lt;BR /&gt;        &lt;SPAN&gt;val &lt;/SPAN&gt;R = FloatArray(&lt;SPAN&gt;9&lt;/SPAN&gt;)&lt;BR /&gt;        &lt;SPAN&gt;val &lt;/SPAN&gt;outR = FloatArray(&lt;SPAN&gt;9&lt;/SPAN&gt;)&lt;BR /&gt;        &lt;SPAN&gt;val &lt;/SPAN&gt;I = FloatArray(&lt;SPAN&gt;9&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;        &lt;SPAN&gt;val &lt;/SPAN&gt;success = SensorManager.getRotationMatrix(R&lt;SPAN&gt;,&lt;/SPAN&gt;I&lt;SPAN&gt;, &lt;/SPAN&gt;gravity&lt;SPAN&gt;, &lt;/SPAN&gt;geomagnetic)&lt;BR /&gt;        &lt;SPAN&gt;if&lt;/SPAN&gt;(success)&lt;BR /&gt;        {&lt;BR /&gt;            &lt;SPAN&gt;val &lt;/SPAN&gt;orientation = FloatArray(&lt;SPAN&gt;3&lt;/SPAN&gt;)&lt;BR /&gt;            SensorManager.remapCoordinateSystem(R&lt;SPAN&gt;, &lt;/SPAN&gt;SensorManager.AXIS_X&lt;SPAN&gt;, &lt;/SPAN&gt;SensorManager.AXIS_Z&lt;SPAN&gt;, &lt;/SPAN&gt;outR)&lt;BR /&gt;            SensorManager.getOrientation(outR&lt;SPAN&gt;, &lt;/SPAN&gt;orientation)&lt;BR /&gt;            &lt;SPAN&gt;val &lt;/SPAN&gt;azimut = orientation[&lt;SPAN&gt;0&lt;/SPAN&gt;]&lt;BR /&gt;            &lt;SPAN&gt;val &lt;/SPAN&gt;azimutInDegree = (Math.toDegrees(azimut.toDouble()))%&lt;SPAN&gt;360&lt;BR /&gt;&lt;/SPAN&gt;            updateHeading(azimutInDegree)&lt;BR /&gt;        }&lt;BR /&gt;    }&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I hope that this solution help someone that has the same problem.&lt;/P&gt;</description>
    <pubDate>Wed, 14 Dec 2022 13:21:58 GMT</pubDate>
    <dc:creator>simone-vitale-overit</dc:creator>
    <dc:date>2022-12-14T13:21:58Z</dc:date>
    <item>
      <title>ArcGisARView with compass not point to nord</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/arcgisarview-with-compass-not-point-to-nord/m-p/1240221#M5921</link>
      <description>&lt;P&gt;Hello community,&lt;/P&gt;&lt;P&gt;I'm working on an Android App that use an ArcGISARView and to get the position of the device, I'm using&lt;/P&gt;&lt;PRE&gt;ArLocationDataSource&lt;/PRE&gt;&lt;P&gt;configured in this way:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;var &lt;/SPAN&gt;criteria = Criteria()&lt;BR /&gt;criteria.&lt;SPAN&gt;powerRequirement &lt;/SPAN&gt;= Criteria.&lt;SPAN&gt;POWER_HIGH&lt;BR /&gt;&lt;/SPAN&gt;criteria.&lt;SPAN&gt;accuracy &lt;/SPAN&gt;= Criteria.&lt;SPAN&gt;ACCURACY_FINE&lt;BR /&gt;&lt;/SPAN&gt;criteria.&lt;SPAN&gt;isSpeedRequired &lt;/SPAN&gt;= &lt;SPAN&gt;true&lt;BR /&gt;&lt;/SPAN&gt;criteria.&lt;SPAN&gt;isAltitudeRequired &lt;/SPAN&gt;= &lt;SPAN&gt;false&lt;BR /&gt;&lt;/SPAN&gt;criteria.&lt;SPAN&gt;isBearingRequired &lt;/SPAN&gt;= &lt;SPAN&gt;true&lt;BR /&gt;&lt;/SPAN&gt;criteria.&lt;SPAN&gt;isCostAllowed &lt;/SPAN&gt;= &lt;SPAN&gt;true&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;val &lt;/SPAN&gt;locationDataSource = ArLocationDataSource(&lt;SPAN&gt;this, &lt;/SPAN&gt;criteria&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;1000&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;1.0F&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arSceneView&lt;/SPAN&gt;.&lt;SPAN&gt;locationDataSource &lt;/SPAN&gt;= locationDataSource&lt;/PRE&gt;&lt;P&gt;The localization work correctly, but in my Scene I show a Compass of the ESRI toolkit that I initialised in this way:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;compass &lt;/SPAN&gt;= Compass(&lt;SPAN&gt;this&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN&gt;compass&lt;/SPAN&gt;!!.&lt;SPAN&gt;isAutoHide &lt;/SPAN&gt;= &lt;SPAN&gt;false&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;compass&lt;/SPAN&gt;!!.addToGeoView(&lt;SPAN&gt;arSceneView&lt;/SPAN&gt;.&lt;SPAN&gt;sceneView&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;I have a strange behaviour by the compass, because not point on the north but I have a rotation of 20/30 degree respect to the real position of north, but not of the map, only of the compass, because the camera points to the real position in the world.&lt;/P&gt;&lt;P&gt;Someone have any idea of why I have this strange behaviour?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2022 16:55:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/arcgisarview-with-compass-not-point-to-nord/m-p/1240221#M5921</guid>
      <dc:creator>simone-vitale-overit</dc:creator>
      <dc:date>2022-12-12T16:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGisARView with compass not point to nord</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/arcgisarview-with-compass-not-point-to-nord/m-p/1241019#M5932</link>
      <description>&lt;P&gt;I found a solution by creating a custom LocationDatasource and making a method to manage what I have received onSensorChanged:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;override fun &lt;/SPAN&gt;&lt;SPAN&gt;onSensorChanged&lt;/SPAN&gt;(event: SensorEvent) {&lt;BR /&gt;    &lt;SPAN&gt;val &lt;/SPAN&gt;type = event.sensor.type&lt;BR /&gt;    &lt;SPAN&gt;if &lt;/SPAN&gt;(type == Sensor.TYPE_ACCELEROMETER) {&lt;BR /&gt;        gravity = lowPassFilter(event.values.clone()&lt;SPAN&gt;, &lt;/SPAN&gt;gravity)&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;    &lt;SPAN&gt;if &lt;/SPAN&gt;(type == Sensor.TYPE_MAGNETIC_FIELD) {&lt;BR /&gt;        geomagnetic = lowPassFilter(event.values.clone()&lt;SPAN&gt;, &lt;/SPAN&gt;geomagnetic)&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;    &lt;SPAN&gt;if&lt;/SPAN&gt;(type == Sensor.TYPE_ROTATION_VECTOR)&lt;BR /&gt;    {&lt;BR /&gt;        &lt;SPAN&gt;val &lt;/SPAN&gt;currentRotation = event.values&lt;BR /&gt;        &lt;SPAN&gt;val &lt;/SPAN&gt;rotationMatrix = FloatArray(&lt;SPAN&gt;9&lt;/SPAN&gt;)&lt;BR /&gt;        SensorManager.getRotationMatrixFromVector(rotationMatrix&lt;SPAN&gt;, &lt;/SPAN&gt;currentRotation)&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;    &lt;SPAN&gt;if&lt;/SPAN&gt;(gravity != &lt;SPAN&gt;null &lt;/SPAN&gt;&amp;amp;&amp;amp; geomagnetic != &lt;SPAN&gt;null&lt;/SPAN&gt;)&lt;BR /&gt;    {&lt;BR /&gt;        &lt;SPAN&gt;val &lt;/SPAN&gt;R = FloatArray(&lt;SPAN&gt;9&lt;/SPAN&gt;)&lt;BR /&gt;        &lt;SPAN&gt;val &lt;/SPAN&gt;outR = FloatArray(&lt;SPAN&gt;9&lt;/SPAN&gt;)&lt;BR /&gt;        &lt;SPAN&gt;val &lt;/SPAN&gt;I = FloatArray(&lt;SPAN&gt;9&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;        &lt;SPAN&gt;val &lt;/SPAN&gt;success = SensorManager.getRotationMatrix(R&lt;SPAN&gt;,&lt;/SPAN&gt;I&lt;SPAN&gt;, &lt;/SPAN&gt;gravity&lt;SPAN&gt;, &lt;/SPAN&gt;geomagnetic)&lt;BR /&gt;        &lt;SPAN&gt;if&lt;/SPAN&gt;(success)&lt;BR /&gt;        {&lt;BR /&gt;            &lt;SPAN&gt;val &lt;/SPAN&gt;orientation = FloatArray(&lt;SPAN&gt;3&lt;/SPAN&gt;)&lt;BR /&gt;            SensorManager.remapCoordinateSystem(R&lt;SPAN&gt;, &lt;/SPAN&gt;SensorManager.AXIS_X&lt;SPAN&gt;, &lt;/SPAN&gt;SensorManager.AXIS_Z&lt;SPAN&gt;, &lt;/SPAN&gt;outR)&lt;BR /&gt;            SensorManager.getOrientation(outR&lt;SPAN&gt;, &lt;/SPAN&gt;orientation)&lt;BR /&gt;            &lt;SPAN&gt;val &lt;/SPAN&gt;azimut = orientation[&lt;SPAN&gt;0&lt;/SPAN&gt;]&lt;BR /&gt;            &lt;SPAN&gt;val &lt;/SPAN&gt;azimutInDegree = (Math.toDegrees(azimut.toDouble()))%&lt;SPAN&gt;360&lt;BR /&gt;&lt;/SPAN&gt;            updateHeading(azimutInDegree)&lt;BR /&gt;        }&lt;BR /&gt;    }&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I hope that this solution help someone that has the same problem.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 13:21:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/arcgisarview-with-compass-not-point-to-nord/m-p/1241019#M5932</guid>
      <dc:creator>simone-vitale-overit</dc:creator>
      <dc:date>2022-12-14T13:21:58Z</dc:date>
    </item>
  </channel>
</rss>

