Skip to content

Commit

Permalink
Merge pull request #12 from bearbotics2358/feather_can_decoder
Browse files Browse the repository at this point in the history
Add initial framework for FeatherCanDecoder and ICoralIntakeDataProvider
  • Loading branch information
aldryd authored Feb 11, 2025
2 parents 4b9362c + f7129fc commit 4e62b5d
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/main/cpp/io/FeatherCanDecoder.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include "io/FeatherCanDecoder.h"

FeatherCanDecoder::FeatherCanDecoder() {
m_coralIntakeAngleDegrees = 0.0;
m_coralCollected = false;
}

void FeatherCanDecoder::Update() {
// @todo Read and unpack the CAN bus data to set m_coralIntakeAngleDegrees and m_coralCollected
}

float FeatherCanDecoder::GetCoralIntakeAngleDegrees() {
return m_coralIntakeAngleDegrees;
}

bool FeatherCanDecoder::IsCoralCollected() {
return m_coralCollected;
}
18 changes: 18 additions & 0 deletions src/main/include/io/FeatherCanDecoder.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once

#include "subsystems/ICoralIntakeDataProvider.h"

class FeatherCanDecoder: public ICoralIntakeDataProvider {
public:
FeatherCanDecoder();

void Update();

// **** ICoralIntakeDataProvider interface functions **** //
float GetCoralIntakeAngleDegrees() override;
bool IsCoralCollected() override;

private:
float m_coralIntakeAngleDegrees;
bool m_coralCollected;
};
11 changes: 11 additions & 0 deletions src/main/include/subsystems/ICoralIntakeDataProvider.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#pragma once

class ICoralIntakeDataProvider {
public:
// Provide the angle of the coral intake/delivery mechanism in degrees
// @todo Decide if this will return the raw angle or the offset from some fixed point (like straight out or down)
virtual float GetCoralIntakeAngleDegrees() = 0;

// Return a simple boolean to indicate whether a piece of coral has been collected
virtual bool IsCoralCollected() = 0;
};

0 comments on commit 4e62b5d

Please sign in to comment.