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

RSDK-4058 Add PowerSensor Component #79

Merged
merged 10 commits into from
Aug 3, 2023

Conversation

oliviamiller
Copy link
Member

@oliviamiller oliviamiller commented Aug 1, 2023

Copy link
Member

@njooma njooma left a comment

Choose a reason for hiding this comment

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

Looks good! Just one change, and also let's get it up to date with main

Comment on lines 7 to 27
class Voltage {
double volts;
bool isAc;

Voltage(this.volts, this.isAc);

factory Voltage.fromProto(GetVoltageResponse pbResponse) {
return Voltage(pbResponse.volts, pbResponse.isAc);
}
}

class Current {
double amperes;
bool isAc;

Current(this.amperes, this.isAc);

factory Current.fromProto(GetCurrentResponse pbResponse) {
return Current(pbResponse.amperes, pbResponse.isAc);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Instead of creating these types which are identical to the response type (but with better names), you can just create typedefs that should do the same thing:

typedef Voltage = GetVoltageResponse;
typedef Current = GetCurrentResponse;

You will have to change a bit of the code, but this way you don't have to create brand new classes

Copy link
Member

@njooma njooma left a comment

Choose a reason for hiding this comment

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

Nice!

@oliviamiller oliviamiller merged commit 82dbe48 into viamrobotics:main Aug 3, 2023
1 check 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.

2 participants