Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added dynamics page and react router #115

Merged
merged 9 commits into from
Jun 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions control-station/src/views/Dynamics/Dynamics.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@
justify-content: center;
align-items: center;
border-radius: 40px;
overflow: hidden;
}
12 changes: 8 additions & 4 deletions control-station/src/views/Dynamics/Dynamics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,26 @@ function Dynamics() {
return (
<div className="dynamics">
<div className="dynamics-sensorbox">
<SensorBox title="Roll" value={gyroscope.roll} />
<SensorBox title="Pitch" value={gyroscope.pitch} />
<SensorBox title="Roll" value={Math.round(gyroscope.roll * 100) / 100} />
<SensorBox title="Pitch" value={Math.round(gyroscope.pitch * 100) / 100} />
</div>
<div className="dynamics-pictures">
<div className="pod-picture-container">
<img
src={FrontPod}
alt="front view of the pod"
style={{ transform: `rotate(${gyroscope.roll}deg)` }}
style={{
transform: `rotate(${Math.round(gyroscope.roll * 100) / 100}deg)`,
}}
vrushang1234 marked this conversation as resolved.
Show resolved Hide resolved
/>
</div>
<div className="pod-picture-container">
<img
src={SidePod}
alt="side view of the pod"
style={{ transform: `rotate(${gyroscope.pitch}deg)` }}
style={{
transform: `rotate(${Math.round(gyroscope.pitch * 100) / 100}deg)`,
}}
/>
</div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions pod-operation/src/components/gyro.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub const PI: f32 = 3.14159265358979323846264338327950288_f32; // 3.1415926535897931f64
vrushang1234 marked this conversation as resolved.
Show resolved Hide resolved
#[cfg(feature = "mpu6050")]
use {
mpu6050::Mpu6050,
Expand Down Expand Up @@ -30,8 +31,8 @@ impl Gyroscope {
pub fn read_orientation(&mut self) -> Orientation {
let angles = self.mpu6050.get_acc_angles().unwrap();
Orientation {
pitch: angles[1],
roll: angles[0],
pitch: (angles[1] * 180.0 / PI),
roll: (angles[0] * 180.0 / PI),
}
}

Expand Down
Loading