Closed caelinsutch closed 4 years ago
Right now the message types are only generated during postinstall or at runtime when calling init()
. I can see how this would be a problem with TypeScript since you need to be able to compile everything before init()
can be run again. We'll either need to make the action types more flexible or find better ways to update the generated message typings when additional packages are sourced.
For now, you can workaround this issue by manually regenerating the message typings using the following command. This should at least unblock you until there's a proper solution.
node node_modules/rclnodejs/scripts/generate_messages.js
We once planed to implement that the message generator could generate the JS messages from IDL dynamically if the required message cannot be found, but can be found through PATH
(the new package will be added after you source the xxx_install.sh
).
Unfortunately, you have to manually delete the generated\
folder in order to trigger to generate the messages completely again, or workaround as @mattrichard said. Thanks!
For now, you can workaround this issue by manually regenerating the message typings using the following command. This should at least unblock you until there's a proper solution.
I got this error:
Start JavaScript message generation...
Caught error: TypeError: Cannot read property 'fields' of undefined
Update - Even after deleting generated
and even the entire folder and reinstalling, I'm still not getting all my packages sourced. For example, when calling a the service /save_maps
from Slamtoolbox, I'm getting the error The message required does not exist: slam_toolbox, srv, SaveMap
. In the same terminal window, I can run that service from the command line.
This is from the CLI:
➜ ros2 service type /save_map
slam_toolbox/srv/SaveMap
I'm able to isolate the problem to the slam_toolbox does not follow the ROS naming convention for placing services interfaces (idl) in a folder named srv
. Instead slam_toolbox services idl lives in a folder named srvs
here.
I'll submit a PR that is a bit more robust handling of such situations.
A short term workaround is to manually change 1 line of code in node_modules/rclnodejs/rclgen_tsd/index.js
line as shown below.
Problem example: