ihmcrobotics / ihmc-java-ros2-communication

Realtime safe implementation of ROS2 in Java.
Apache License 2.0
21 stars 5 forks source link

help compiling test #9

Closed schragnasher closed 1 year ago

schragnasher commented 1 year ago

I am attempting to compile the test code in the source files but I get this error when attempting to run. Any help in the right direction is appreciated. I am running under Foxy, unsure if that will matter or not. I have had a very hard time finding a java ROS2 foxy library.

\\wsl$\Ubuntu-20.04\home\josh\projects\ihmc7\src\main\java\org\example\Main.java:7: error: cannot access Int64
import std_msgs.msg.dds.Int64;
                       ^
  bad class file: /home/josh/.gradle/caches/modules-2/files-2.1/us.ihmc/ros2-common-interfaces/0.22.2/c0b1693f1a615c947fea6007c2cf61118ae5526/ros2-common-interfaces-0.22.2.jar(/std_msgs/msg/dds/Int64.class)
    class file has wrong version 61.0, should be 55.0
    Please remove or make sure it appears in the correct subdirectory of the classpath.
calvertdw commented 1 year ago

Hi there! I'm going to go with a quick answer here, but let me know if you have additional questions about this library. It's a very complicated story. :)

See https://javaalmanac.io/bytecode/versions/.

We compiled the JAR with Java 17 but you are running with Java 11. Try it with JDK 17.

schragnasher commented 1 year ago

Ah yes, that helped now im gettign this exception when running.

221214 15:17:28:819 [INFO] (ROS2NodeInterface.java:71): ROS_DOMAIN_ID from environment is 0 (fallback only; ignore if set manually)
Exception in thread "main" java.lang.RuntimeException: Cannot start realtime thread, do you have permission
    at us.ihmc.realtime.RealtimeThread.start(RealtimeThread.java:142)
    at us.ihmc.util.PeriodicRealtimeThreadScheduler.schedule(PeriodicRealtimeThreadScheduler.java:53)
    at us.ihmc.ros2.RealtimeROS2Node.spin(RealtimeROS2Node.java:360)
    at org.example.Main.main(Main.java:31)

I assume its something about how I am developing. I am using intellij running my code in WSL2. Any insight into this issue?

schragnasher commented 1 year ago

I was able to get a non realtime subscription to function. receiving from the demo talker over chatter. That is a good step.

calvertdw commented 1 year ago

Yes, you need to be running native Linux with our RT prempt kernel to start realtime threads.