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

Controller Module Header File #34

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Controller Module Header File #34

wants to merge 2 commits into from

Conversation

riyapatel25
Copy link

@riyapatel25 riyapatel25 commented Nov 25, 2024

Added header file for controller modules

  • defined structs and public interfaces

@JasonBrave
Copy link
Member

Have you looked at the embedded coding standard yet https://docs.waterloorocketry.com/general/standards/embedded-coding-standard.html

* Must be called before RTOS scheduler starts
* @return true if initialization successful
*/
bool Controller_Init(void);
Copy link
Member

Choose a reason for hiding this comment

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

we use snake_case

// Output of controller to be sent to servo via CAN
typedef struct {
float commanded_angle; // Desired angle
float actual_angle; // Current angle
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are you interested in sending the actual angle? That should be handled within MCB itself

float timestamp; // Timestamp in ms
} controller_state_t;

// Output of controller to be sent to servo via CAN
Copy link
Collaborator

Choose a reason for hiding this comment

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

// Output of controller to be sent to servo motor controller board via CAN

Copy link

Choose a reason for hiding this comment

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

Attitude is a 4 vector with the quaternions q0 - q3.
State vector also includes canard coefficient CL, and canard angle delta, which are both states

float commanded_angle; // Desired angle
float actual_angle; // Current angle
uint32_t timestamp; // Timestamp
uint32_t servo_id; // Servo identifier
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you explain what servo_id is for? We only have one servo. @rexblade21 I'd like you to work with processor ppl to figure out what u want in your message

* @param output Pointer to store output -> type defined in state_estimation.h
* @return false if no output available
*/
bool Controller_Get_Latest_Output(control_output_SE_t *output);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Make sure state_estimation.h correctly defines control_output_SE_t

@@ -0,0 +1,58 @@
#ifndef CONTROLLER_H_
#define CONTROLLER_H_
Copy link
Collaborator

Choose a reason for hiding this comment

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

update header file

@celery6 celery6 linked an issue Nov 29, 2024 that may be closed by this pull request
Copy link
Collaborator

@celery6 celery6 left a comment

Choose a reason for hiding this comment

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

added some comments in the google doc
@Joe-Joe-Joe-Joe @FinnBreu can u guys also review the design in the google doc?

float actual_angle; // Current angle
uint32_t timestamp; // Timestamp
uint32_t servo_id; // Servo identifier
} controller_can_output_t;
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is an internal thing right? does it need to be exposed in this .h

@Joe-Joe-Joe-Joe
Copy link

Comments in the gdoc

#include <stdbool.h>

/* Enums/Types */
typedef struct {

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

#41
im gonna make vectors a common project-wide type

@celery6 celery6 requested a review from taisirhassan December 20, 2024 18:46
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.

controller module design
6 participants