Skip to content

Commit 17713e1

Browse files
committed
IMU added
1 parent 6c96e67 commit 17713e1

3 files changed

Lines changed: 97 additions & 5 deletions

File tree

.idea/workspace.xml

Lines changed: 14 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
title: IMU
3+
description: Reading orientation with NextIMU
4+
sidebar:
5+
order: 5
6+
---
7+
8+
import { Tabs, TabItem } from '@astrojs/starlight/components';
9+
10+
`NextIMU` is a wrapper for the Control Hub or an `IMU` that uses lazy initialization.
11+
12+
## Creating a NextIMU
13+
14+
<Tabs syncKey="language">
15+
<TabItem label="Kotlin">
16+
```kotlin
17+
val imu = NextIMU() // Defaults to the configuration name "imu"
18+
19+
val imu = NextIMU("imu") // Using a custom configuration name
20+
```
21+
</TabItem>
22+
<TabItem label="Java">
23+
```java
24+
NextIMU imu = new NextIMU(); // Defaults to the configuration name "imu"
25+
26+
NextIMU imu = new NextIMU("imu"); // Using a custom configuration name
27+
```
28+
</TabItem>
29+
</Tabs>
30+
31+
## Usage
32+
33+
### `initialize(parameters)`
34+
35+
Initializes the IMU with the given `IMU.Parameters`, such as the hub's mounting orientation.
36+
37+
<Tabs syncKey="language">
38+
<TabItem label="Kotlin">
39+
```kotlin
40+
imu.initialize(IMU.Parameters(RevHubOrientationOnRobot(LogoFacingDirection.UP, UsbFacingDirection.FORWARD)))
41+
```
42+
</TabItem>
43+
<TabItem label="Java">
44+
```java
45+
imu.initialize(new IMU.Parameters(new RevHubOrientationOnRobot(LogoFacingDirection.UP, UsbFacingDirection.FORWARD)));
46+
```
47+
</TabItem>
48+
</Tabs>
49+
50+
### `resetYaw()`
51+
52+
Resets the yaw angle to zero.
53+
54+
<Tabs syncKey="language">
55+
<TabItem label="Kotlin">
56+
```kotlin
57+
imu.resetYaw()
58+
```
59+
</TabItem>
60+
<TabItem label="Java">
61+
```java
62+
imu.resetYaw();
63+
```
64+
</TabItem>
65+
</Tabs>
66+
67+
### `angularVelocity`
68+
69+
`AngularVelocity` the robot's current angular velocity, in radians per second.
70+
71+
<Tabs syncKey="language">
72+
<TabItem label="Kotlin">
73+
```kotlin
74+
val turnRate = imu.angularVelocity
75+
```
76+
</TabItem>
77+
<TabItem label="Java">
78+
```java
79+
AngularVelocity turnRate = imu.getAngularVelocity();
80+
```
81+
</TabItem>
82+
</Tabs>

src/content/docs/hardware/sensors/pinpoint.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Pinpoint
2+
title: Pinpoints
33
description: Reading odometry with NextPinpoint
44
sidebar:
55
order: 4

0 commit comments

Comments
 (0)