Unity-Technologies / ROS-TCP-Connector

Apache License 2.0
296 stars 93 forks source link

String values in message definitions are not parsed correctly #292

Open noirb opened 2 years ago

noirb commented 2 years ago

Describe the bug When generating messages from ROS2 message definitions, default values can result in a C# class which cannot be compiled.

To Reproduce Steps to reproduce the behavior:

  1. Generate C# class for a message definition which contains string constants or default values, e.g.:
    
    int32 status
    int32 OK = 200
    int32 ERROR = 300

string msg string OK_MSG = "Everything is fine" string ERROR_MSG = "Something is wrong"

2. After message generation, the `int32` constants will be fine, but the string constants will be formatted incorrectly:

```csharp
...
public int status;
public int OK = 200;
public int ERROR = 300;

public string msg;
public string OK_MSG = ""Everything is fine"";
public string ERROR_MSG = ""Something is wrong"";
...

Expected behavior All standard features of ROS2 message definitions should be handled.

Environment (please complete the following information, where applicable):