RobotWebTools / ros2-web-bridge

Bridging your browser to the ROS 2.0
Apache License 2.0
203 stars 68 forks source link

Bug ROS2 custom message in subfolder #175

Closed sirawats closed 1 week ago

sirawats commented 3 years ago

My custom msg directory

|--oru_msgs
|  |--msg
|     |--bunker_base
|        |--BunkerMototState.msg

then npm install so rclnodejs generated the ros2 msg js interface

|--ros2-web-bridge/node_modules/rclnodejs/
|  |--generated
|     |--oru_msgs
|        |--oru_msgs__bunker_base__BunkerMotorState.js 

The result: Screenshot from 2021-02-05 17-08-22-x

According to my investigation, I had 2 methods to solve this

1. Change my oru_msgs directory structure (remove bunker_base/ )

|--oru_msgs
|  |--msg
|     |--BunkerMototState.msg

then npm install, so rclnodejs/generation is going to be

|--ros2-web-bridge/node_modules/rclnodejs/
|  |--generated
|     |--oru_msgs
|        |--oru_msgs__msg__BunkerMotorState.js 

but this gonna be force user to can't have subfolder and inflexible!

2. Manually edit rclnodejs/generated without change directory structure

|--ros2-web-bridge/node_modules/rclnodejs/
|  |--generated
|     |--oru_msgs
|        |--oru_msgs__bunker_base__BunkerStatus.js  ---> oru_msgs__msg__BunkerMotorState.js

and edit line: 101 of oru_msgs__msg__BunkerMotorState.js from return {pkgName: 'oru_msgs', subFolder: 'bunker_base', interfaceName: 'BunkerMotorState'}; to return {pkgName: 'oru_msgs', subFolder: 'msg', interfaceName: 'BunkerMotorState'};

The result: Screenshot from 2021-02-05 17-13-19-x

So I think this should be improved

debanik123 commented 1 year ago

source your catkin_ws with your custom msg