Skip to content

Feat/The ORBIS Interface#39

Merged
Anonimous-User merged 21 commits intomainfrom
test/new_OrbisBR_interface
Mar 11, 2026
Merged

Feat/The ORBIS Interface#39
Anonimous-User merged 21 commits intomainfrom
test/new_OrbisBR_interface

Conversation

@anthonyliu5261
Copy link
Contributor

Changed the interface from Ben's version to speak with the sensor. Offset functionality has been fully tested. Save configuration function has not been saved. Rewrote command structure.

@Anonimous-User Anonimous-User changed the title Added interface ORBIS Interface Feb 5, 2026
@KevinLuo423 KevinLuo423 changed the title ORBIS Interface Feat/The ORBIS Interface Feb 5, 2026
Copy link
Contributor

@AlexBailey11 AlexBailey11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments for changes


/* ----- SELF CALIBRATION STATUS 2 ----- */
// self-calibration status request again after, expect counter to change
_serial->write(OrbisCommands::SELF_CALIB_STATUS); delay(1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than an if with a hard time limit of 1ms (which is not a lot), we can do while(serial.available < n and custome_timeout_counter < time_out)

This is lowk something you can implement for every single "I need to wait for sensor to respond", including already existing "while(!_serial.available())"

// After writing POSITION_OFFSET, the next four bytes are what you subtract from your initial position. We want to start at 0, so we first
// get our initial position, and then send that position as the four bytes. Inital position - inital position = 0.

while (_serial->available()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these are here just to clear the Serial buffer, please note that somewhere
Make it a one liner lowkenuinely


while (_serial->available() < 4);

if (_serial->available() < 4) // check if received all 4 bytes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically we don't need this if anymore. You can move this into the while loop as suggested earlier to handle timeout

_lastConversion.status = anyError ? SteeringEncoderStatus_e::STEERING_ENCODER_ERROR : SteeringEncoderStatus_e::STEERING_ENCODER_NOMINAL;

// Extract 14-bit position data
uint16_t raw_position_data = (((uint16_t) general1) << OrbisConstants::POSITION_DATA_MASK_1) | (uint16_t) general2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this into one line

// Convert Position Data to Angle
_lastConversion.raw = _position_data;

float angle = ((float)_position_data / OrbisConstants::ENCODER_RESOLUTION ) * OrbisConstants::DEGREES_PER_REVOLUTION;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: we do conversion in steeringSystem

void _decodeErrors(uint8_t general, uint8_t detailed);

HardwareSerial* _serial;
SteeringEncoderConversion_s _lastConversion; // initialize variable _lastConversion of type SteeringEncoderConversion_s.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name this better. This stores way more than just last conversion

bool noData = false; // No data received
};

struct SteeringEncoderConversion_s // This is the final struct I would like to send across the car. What's seen in foxglove?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to be more fit


}

SteeringEncoderConversion_s OrbisBR::convert()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not "convert". rename

_decodeErrors(general_status, detailed);

// Decode errors, detailed status bytes
bool anyError =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move all of these into your _decodeErrors method

return;
}

uint8_t echo = _serial->read();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

goof ahh spacing breh

Copy link
Contributor

@Anonimous-User Anonimous-User left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gj

@Anonimous-User Anonimous-User dismissed AlexBailey11’s stale review March 11, 2026 23:22

need to test steeringsys

@Anonimous-User Anonimous-User merged commit d3ffb21 into main Mar 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants