Skip to content

BUG: Constants as pure message type #8

Open
@kbudin

Description

@kbudin
  • I'm submitting a bug report when having nothing but constants in a message type
    [ X ] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
    [ ] question about how to use this project

  • Summary
    It is regarded as best practice to have constants and nothing but constants in their own custom message type and then referred to from main custom message type.
    But generated typescript appends Const keyword to enums but does not add Const keyword in the files referring to them, so generating invalid typescript code.

  • Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

Example:
RobotMode.msg file:
`
std_msgs/Header header

RobotModeConstants robot_mode_constant

int8 value
`

RobotModeConstants.msg file:
`

int8 DISCONNECTED=0
int8 BOOTING=1
int8 POWER_OFF=2
int8 POWER_ON=3
int8 IDLE=4
int8 RUNNING=5

`

Generated typescript file:
`
export enum IRosTypeRobotModeConstantsConst {
DISCONNECTED = 0,
BOOTING = 1,
POWER_OFF = 2,
POWER_ON = 3,
IDLE = 4,
RUNNING = 5,
}

export interface IRosTypeRobotMode {
header: IRosTypeStdMsgsHeader;
robot_mode_constant: IRosTypeRobotModeConstants;
value: number;
}
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions