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

Change state and drive mode messages from string to custom message types #14

Closed
mattjay1024 opened this issue Feb 6, 2020 · 1 comment · May be fixed by #15
Closed

Change state and drive mode messages from string to custom message types #14

mattjay1024 opened this issue Feb 6, 2020 · 1 comment · May be fixed by #15
Labels
enhancement New feature or request question Further information is requested

Comments

@mattjay1024
Copy link
Contributor

mattjay1024 commented Feb 6, 2020

I'm not sure how or even if Yeti dealt with this, but every node I've written with RSC in mind needs a parameter for the state and drive mode string (unless I want to use magic strings (which I don't)).

What we can do instead is make a custom message, with the states declared as constants there. So instead of

if (state_msg.data == "ready") {
    // do stuff
}

it becomes something like

if (state_msg.state == state_msg.STATE_READY) {
    // do stuff
}

The message types might look something like this

# State
int32 STATE_KILL = -1
int32 STATE_PAUSE = 0
int32 STATE_READY = 1
int32 STATE_STARTUP = 2
int32 STATE_SOFT_PAUSE = 3
int32 state

# Drive Mode
int32 MODE_MANUAL = 0
int32 MODE_AUTO = 1
int32 mode

I honestly don't remember if we talked about this and discarded it before, but it's been bothering me while going through Ohm's code.

@mattjay1024 mattjay1024 added enhancement New feature or request question Further information is requested labels Feb 6, 2020
@davidcutting davidcutting linked a pull request Jan 25, 2022 that will close this issue
@andyblarblar
Copy link
Member

Now that we are just using ros2 as the main branch to preserve the old code, this old issue can finally be put to rest.

Also wow ISC really did use stringly typed code at one point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants