# Compass

# Compass

Artifact:[androidx.car.app:app](https://developer.android.com/jetpack/androidx/releases/car-app)  
[View Source](https://cs.android.com/search?q=file:androidx/car/app/hardware/info/Compass.java+class:androidx.car.app.hardware.info.Compass)  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.1.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/car/app/hardware/info/Compass "View this page in Java")

<br />

```
@CarProtocol
@RequiresCarApi(value = 3)
class Compass
```

<br />

*** ** * ** ***

Information about car specific compass available from the car hardware.

## Summary

|                                                                                                                                                                                                                                                                                                                                                          ### Public constructors                                                                                                                                                                                                                                                                                                                                                          |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Compass](https://developer.android.com/reference/kotlin/androidx/car/app/hardware/info/Compass#Compass(androidx.car.app.hardware.common.CarValue<java.util.List<java.lang.Float>>))`(orientations: `[CarValue](https://developer.android.com/reference/kotlin/androidx/car/app/hardware/common/CarValue)`<(`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`!>!>)` Creates an[Compass](https://developer.android.com/reference/kotlin/androidx/car/app/hardware/info/Compass)with the given raw data. |

|                                                                                                                                                                                       ### Public functions                                                                                                                                                                                       |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                                                                                                                                                                                                                                                              | [equals](https://developer.android.com/reference/kotlin/androidx/car/app/hardware/info/Compass#equals(java.lang.Object))`(other: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?)` |
| [CarValue](https://developer.android.com/reference/kotlin/androidx/car/app/hardware/common/CarValue)`<(`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`!>!>` | [getOrientations](https://developer.android.com/reference/kotlin/androidx/car/app/hardware/info/Compass#getOrientations())`()` Returns the raw compass data from the car sensor.                                  |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                                                                                                                                                                                                                                      | [hashCode](https://developer.android.com/reference/kotlin/androidx/car/app/hardware/info/Compass#hashCode())`()`                                                                                                  |
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)                                                                                                                                                                                                                                                                                                                | [toString](https://developer.android.com/reference/kotlin/androidx/car/app/hardware/info/Compass#toString())`()`                                                                                                  |

## Public constructors

### Compass

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.1.0)  

```
Compass(orientations: CarValue<(Mutable)List<Float!>!>)
```

Creates an[Compass](https://developer.android.com/reference/kotlin/androidx/car/app/hardware/info/Compass)with the given raw data.  

|                                                    Throws                                                     |
|---------------------------------------------------------------------------------------------------------------|--------------------------|
| [java.lang.NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException.html) | if`orientations`is`null` |

## Public functions

### equals

```
fun equals(other: Any?): Boolean
```  

### getOrientations

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.1.0)  

```
fun getOrientations(): CarValue<(Mutable)List<Float!>!>
```

Returns the raw compass data from the car sensor.

Individual values can be`Float.Nan`if not reported. The array values consist of:

- \[0\]: Azimuth, angle between the magnetic north direction and the y-axis, around the z-axis (0 to 359). 0=North, 90=East, 180=South, 270=West
- \[1\]: Pitch, rotation around y-axis (-90 to 90), where nose down is positive
- \[2\]: Roll, rotation around x-axis (-180 to 180), where right door down is positive  

### hashCode

```
fun hashCode(): Int
```  

### toString

```
fun toString(): String
```