MATLAB Answers

how can I solve "rosinit" command error for MATLAB-ROS connection

3 views (last 30 days)
When i run "rosinit" command for 2019b i see error like below. I checked the previous questions about this problem. However, I can not solve until now.
Exception in thread "ROS Executor Thread": org.ros.exception.RosMessageRuntimeException: java.lang.ClassNotFoundException: std_msgs.uint32
at org.ros.internal.message.definition.MessageDefinitionReflectionProvider.get(MessageDefinitionReflectionProvider.java:66)
at org.ros.internal.message.Md5Generator.generate(Md5Generator.java:44)
at org.ros.internal.message.Md5Generator$1.variableValue(Md5Generator.java:61)
at org.ros.internal.message.definition.MessageDefinitionParser.parseField(MessageDefinitionParser.java:172)
at org.ros.internal.message.definition.MessageDefinitionParser.parse(MessageDefinitionParser.java:107)
at org.ros.internal.message.Md5Generator.generateText(Md5Generator.java:86)
at org.ros.internal.message.Md5Generator.generate(Md5Generator.java:49)
at org.ros.internal.message.Md5Generator$1.variableValue(Md5Generator.java:61)
at org.ros.internal.message.definition.MessageDefinitionParser.parseField(MessageDefinitionParser.java:172)
at org.ros.internal.message.definition.MessageDefinitionParser.parse(MessageDefinitionParser.java:107)
at org.ros.internal.message.Md5Generator.generateText(Md5Generator.java:86)
at org.ros.internal.message.Md5Generator.generate(Md5Generator.java:49)
at org.ros.internal.message.topic.TopicDescriptionFactory.newFromType(TopicDescriptionFactory.java:36)
at org.ros.internal.node.DefaultNode.newPublisher(DefaultNode.java:281)
at org.ros.internal.node.RosoutLogger.<init>(RosoutLogger.java:41)
at org.ros.internal.node.DefaultNode.start(DefaultNode.java:195)
at org.ros.internal.node.DefaultNode.access$000(DefaultNode.java:90)
at org.ros.internal.node.DefaultNode$1.run(DefaultNode.java:182)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: std_msgs.uint32
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.ros.internal.message.definition.MessageDefinitionReflectionProvider.get(MessageDefinitionReflectionProvider.java:62)
... 20 more
Exception in thread "ROS Executor Thread": org.ros.exception.RosMessageRuntimeException: java.lang.ClassNotFoundException: std_msgs.uint32
at org.ros.internal.message.definition.MessageDefinitionReflectionProvider.get(MessageDefinitionReflectionProvider.java:66)
at org.ros.internal.message.Md5Generator.generate(Md5Generator.java:44)
at org.ros.internal.message.Md5Generator$1.variableValue(Md5Generator.java:61)
at org.ros.internal.message.definition.MessageDefinitionParser.parseField(MessageDefinitionParser.java:172)
at org.ros.internal.message.definition.MessageDefinitionParser.parse(MessageDefinitionParser.java:107)
at org.ros.internal.message.Md5Generator.generateText(Md5Generator.java:86)
at org.ros.internal.message.Md5Generator.generate(Md5Generator.java:49)
at org.ros.internal.message.Md5Generator$1.variableValue(Md5Generator.java:61)
at org.ros.internal.message.definition.MessageDefinitionParser.parseField(MessageDefinitionParser.java:172)
at org.ros.internal.message.definition.MessageDefinitionParser.parse(MessageDefinitionParser.java:107)
at org.ros.internal.message.Md5Generator.generateText(Md5Generator.java:86)
at org.ros.internal.message.Md5Generator.generate(Md5Generator.java:49)
at org.ros.internal.message.topic.TopicDescriptionFactory.newFromType(TopicDescriptionFactory.java:36)
at org.ros.internal.node.DefaultNode.newPublisher(DefaultNode.java:281)
at org.ros.internal.node.RosoutLogger.<init>(RosoutLogger.java:41)
at org.ros.internal.node.DefaultNode.start(DefaultNode.java:195)
at org.ros.internal.node.DefaultNode.access$000(DefaultNode.java:90)
at org.ros.internal.node.DefaultNode$1.run(DefaultNode.java:182)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: std_msgs.uint32
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.ros.internal.message.definition.MessageDefinitionReflectionProvider.get(MessageDefinitionReflectionProvider.java:62)
... 20 more
Exception in thread "ROS Executor Thread": org.ros.exception.RosMessageRuntimeException: java.lang.ClassNotFoundException: std_msgs.uint32
at org.ros.internal.message.definition.MessageDefinitionReflectionProvider.get(MessageDefinitionReflectionProvider.java:66)
at org.ros.internal.message.Md5Generator.generate(Md5Generator.java:44)
at org.ros.internal.message.Md5Generator$1.variableValue(Md5Generator.java:61)
at org.ros.internal.message.definition.MessageDefinitionParser.parseField(MessageDefinitionParser.java:172)
at org.ros.internal.message.definition.MessageDefinitionParser.parse(MessageDefinitionParser.java:107)
at org.ros.internal.message.Md5Generator.generateText(Md5Generator.java:86)
at org.ros.internal.message.Md5Generator.generate(Md5Generator.java:49)
at org.ros.internal.message.Md5Generator$1.variableValue(Md5Generator.java:61)
at org.ros.internal.message.definition.MessageDefinitionParser.parseField(MessageDefinitionParser.java:172)
at org.ros.internal.message.definition.MessageDefinitionParser.parse(MessageDefinitionParser.java:107)
at org.ros.internal.message.Md5Generator.generateText(Md5Generator.java:86)
at org.ros.internal.message.Md5Generator.generate(Md5Generator.java:49)
at org.ros.internal.message.topic.TopicDescriptionFactory.newFromType(TopicDescriptionFactory.java:36)
at org.ros.internal.node.DefaultNode.newPublisher(DefaultNode.java:281)
at org.ros.internal.node.RosoutLogger.<init>(RosoutLogger.java:41)
at org.ros.internal.node.DefaultNode.start(DefaultNode.java:195)
at org.ros.internal.node.DefaultNode.access$000(DefaultNode.java:90)
at org.ros.internal.node.DefaultNode$1.run(DefaultNode.java:182)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: std_msgs.uint32
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.ros.internal.message.definition.MessageDefinitionReflectionProvider.get(MessageDefinitionReflectionProvider.java:62)
... 20 more
Error creating the node /matlab_global_node_07873.

  0 Comments

Sign in to comment.

Accepted Answer

Cam Salzberger
Cam Salzberger on 8 May 2020
Hello Sinan,
This is a very uncommon symptom that I've seen only a couple of times. There are a few things that could be causing it that I have heard of, so let me go through them.
  • Language Settings: This same question was ask on ROS Answers a while back. As noted by this user (and I believe I've heard of it from one other user as well), the issue was caused by the language settings on their computer. You should at least be able to diagnose this by changing your computer language settings to English, and seeing if that resolves the issue.
  • Java/MATLAB Path: As I noted for this user with the same question, this could be caused by artifacts from custom messages being set up for MATLAB (or even an earlier version of MATLAB) that aren't fully functional any longer. Check your javaclasspath for any entries that are outside of the MATLAB installation directory. Also check through the JAR files listed for "ros", and see if any seem to be in an odd location (they should be in <matlabroot>\java\jarext\rosjava) or are listed for a specific locale (they should not be localized, like if they were in a folder called "ja_JP"). Also check your normal MATLAB search path for any ROS-related folders outside the MATLAB installation root. They would typically be in matlab_gen\msggen, but may not necessarily if they were moved around. Remove custom message libraries (JAR or MATLAB files) from their respective paths, and see if that helps. You can easily reset the MATLAB path with "restoredefaultpath" and then "rehash toolboxcache", and then follow it up with "savepath" if you want to keep it between sessions. If you modify the Java class path, you will need to restart MATLAB.
  • Changed Installed JAR Files: If you have manually modified any of the installed MATLAB files, especially the ROS-related JAR files, I can only recommend that you reinstall MATLAB. Some people have instructed users to replace their existing JAR files. Do not do this. If it works at all, it is not guaranteed across operating systems, locales, or different versions of MATLAB. If you wish to update your built-in ROS message definitions to use those from a different version of ROS, there is a much safer way of doing so that will also allow you to revert back to using the original defintions (not breaking your install).
  • Corrupted Installation Files: It is possible that MATLAB simply wasn't installed correctly. If nothing else is working, you can try removing and reinstalling MATLAB. To be even safer, consider removing (or renaming) your preferences directory after uninstallation to ensure you get a clean install.
  • Redefine Built-in Messages: If even reinstallation doesn't work, you can try redefining which Java and MATLAB files ROS Toolbox uses when creating ROS messages. Acquire the ROS message packages from your preferred distribution of ROS. You will probably need to modify the packages' package.xml file to use "format 1" instead of "format 2" (see here for more details). Then you can follow the instructions here to update built-in messages with custom message definitions.
Hope this helps!
-Cam

  2 Comments

Cam Salzberger
Cam Salzberger on 11 May 2020
Hey Sinan,
Out of curiosity and for the purposes of helping future users, if the issue is fixed, which step resolved it?
Sinan Ilgen
Sinan Ilgen on 14 May 2020
Hello Mr. Salzberger,
Your "Language Settings" suggestion solved the problem. There is no problem right now. I'm sorry for the late reply.
Thank you for your support.

Sign in to comment.

More Answers (1)

semih kilic
semih kilic on 12 May 2020
Edited: semih kilic on 12 May 2020
I have the same error message, would love to know what worked. Changing the language settings did not work for me.

  0 Comments

Sign in to comment.

Products


Release

R2019b