You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 14, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Jan 14, 2023. It is now read-only.
generate java code for actions in same source workspace #71
I'm very happy to see the PRs provided by @exo-core wrt. code generation for action files...
we've recently been hacking around this, too, without finding a satisfying solution
the current kinetic branch works with actions which are already released (although, I think this is because the msg files generated for each action can be found in the msg folder within the respective pkg under /opt/ros - thus the java classes get generated by the same MessageGeneration doing the topic msg files)
still, I'm having trouble generating code for actions which are defined in packages which are located in the same source workspace as rosjava_bootstrap, genjava & co
we also need this to work for our CI (travis)...using ros-industrial/industrial_ci where everything is compiled in a single workspace (in which src is read-only)
I'm still playing around with it a bit more and try to provide a rosinstall file to reproduce my usecase.
@exo-core@jubeira
what is your experience? have you used it this way?
I sometimes had issuies because the generated *.jar files were empty for some packages when building them with catkin_make, but I never really looked much into it... I was also playing around with quite some VM's and older ROS versions because I was trying to compile a version of my messages that I could use on our KUKA Sunrise Cabinet (Windows + Java 1.6 😒), so I'm not sure in what environment I experienced that error...
However I can tell that message generation works fine in kinetic when building them with genjava_message_artifacts --verbose or genjava_message_artifacts --verbose -p <PACKAGE_NAME> as suggested in this tutorial.
I'll take a closer look at this when I'm back in the office on Monday...
uname -v: # 36~16.04.1-Ubuntu SMP Wed Aug 15 17:21:05 UTC 2018
ROS Kinetic (I don't have anything installed related to rosjava, i.e. apt purge ros-kinetic-rosjava*)
I'm using python-catkin-tools, i.e. catkin build instead of catkin_make
What I'm trying to do:
generate Maven artifacts (*.jar files) to be used in my rosjava project implementing ActionServers, i.e. the message artifacts will be added as dependencies in my project's pom.xml`)
the Maven artifacts need to be installed to my local Maven repository in ~/.m2
I must not generate code in source space (this is enforced by industrial_ci)
👉 to achieved this, I will use a modified branch of rosjava_build_tools
Test1: https://github.com/fmessmer/helloworld_rosjava_messages/tree/a45530618642966b327a0e36608a7328a4023a51:
using catkin build, all java files (6 files per action) are nicely generated for HelloWorld.action (they can be found in build/helloworld_rosjava_messages/helloworld_msgs/src/main/java/helloworĺd_msgs)
also, the maven artifact can be redirected from devel/share/maven/org/ros/rosjava_messages/helloworld_msgs to ~/.m2/repository/org/ros/rosjava_messages/helloworld_msgs by setting export ROS_MAVEN_DEPLOYMENT_REPOSITORY=~/.m2/repository
Test2: fmessmer/helloworld_rosjava_messages@26a4b31
adding a sub_msgs package and using it within HelloWorldSub.action in fmessmer/helloworld_rosjava_messages@26a4b31, no java files (not even for HelloWorld.action - which worked in Test1) are generated for helloworld_msgs anymore, i.e. there is no src folder in build/helloworld_rosjava_messages/helloworld_msgs...
the java classes for sub_msgs are generated successfully
So it seems, it's not the messages/actions being located in the same workspace as rosjava_bootstrap etc. but the dependencies not being considered correctly (?)
Ran rosinstall src https://raw.githubusercontent.com/fmessmer/helloworld_rosjava_messages/master/.travis.rosinstall
Cloned your repository to test_ws/src/helloworld_rosjava_messages
Executed catkin build
After that I checked test_ws/devel/share/maven/org/ros/rosjava_messages for the generated *.jar files and it looks fine for both packages. Also the content of test_ws/devel/share/maven/org/ros/rosjava_messages/helloworld_msgs/0.0.0/helloworld_msgs-0.0.0.jar looks fine to me:
What am I missing? Do we need to have a copy of that file in another directory?
@exo-core
you are right...it seems to work as long as `ROS_MAVEN_DEPLOYMENT_REPOSITORY``is not set...
(maybe the location is hard-coded at some lines of code so this feature cannot be used correctly to freely specify the maven target destination)
let me have another look at this...but it won't be before Wednesday
hmm, I can't get it to work...but I don't think it's (just) the message generation for actions...
here is what I found out:
as long as ROS_MAVEN_DEPLOYMENT_REPOSITORY is not set (or set to .../devel/share/maven both the jar and the pom files are generated correctly under .../devel/share/maven/...
I also managed to redirect my local maven repository (default: ~/.m2/repository) to the same .../devel/share/maven/... by adding the following ~/.m2/settings.xml
by doing so, everything happens in .../devel/share/maven/... and I can compile my project locally
however, I'm having problems to get this set up in TravisCI using industrial_ci
I just can't figure out why it is so difficult to tell rosjava to deploy/install to ~/.m2/repository?
apparently, setting ROS_MAVEN_DEPLOYMENT_REPOSITORY does not work... @exo-core@jubeira: can you confirm this?
I also found this, so there seems to be a gradle task that deploys/installs to ~/.m2/repository (i.e. default maven local repository)
but I don't know where I have to add this install task so that it gets executed when running catkin build
instead, installDist seems to be the default task which deploys/installs to .../devel/share/maven...
one more thing:
having compiled my workspace as described above, i.e. all in .../devel/share/maven/..., I can go to .../build/<one_of_my_msg_packages> and execute .gradlew install there afterwards to get the jar and the pom installed to ~/.m2/repository....but I need this to be done thrughout catkin build already...
Activity
exo-core commentedon Sep 1, 2018
Hi @fmessmer ,
I sometimes had issuies because the generated
*.jarfiles were empty for some packages when building them withcatkin_make, but I never really looked much into it... I was also playing around with quite some VM's and older ROS versions because I was trying to compile a version of my messages that I could use on our KUKA Sunrise Cabinet (Windows + Java 1.6 😒), so I'm not sure in what environment I experienced that error...However I can tell that message generation works fine in kinetic when building them with
genjava_message_artifacts --verboseorgenjava_message_artifacts --verbose -p <PACKAGE_NAME>as suggested in this tutorial.I'll take a closer look at this when I'm back in the office on Monday...
fmessmer commentedon Sep 1, 2018
Thanks for your reply @exo-core
So, you are saying that the build is not 100% reliable? - could be some dependency/race condition...
I've prepared a small demo repo that we could use for discussion:
https://github.com/fmessmer/helloworld_rosjava_messages
Some details about my setup:
uname -v: # 36~16.04.1-Ubuntu SMP Wed Aug 15 17:21:05 UTC 2018rosjava, i.e.apt purge ros-kinetic-rosjava*)python-catkin-tools, i.e.catkin buildinstead ofcatkin_makeWhat I'm trying to do:
*.jarfiles) to be used in myrosjavaproject implementing ActionServers, i.e. the message artifacts will be added asdependencies in my project'spom.xml`)~/.m2industrial_ci)👉 to achieved this, I will use a modified branch of
rosjava_build_toolsfmessmer commentedon Sep 1, 2018
Experimenting some more:
(to reproduce set up a workspace based on the
.travis.rosinstallfile included in https://github.com/fmessmer/helloworld_rosjava_messages)Test1: https://github.com/fmessmer/helloworld_rosjava_messages/tree/a45530618642966b327a0e36608a7328a4023a51:
using
catkin build, all java files (6 files per action) are nicely generated forHelloWorld.action(they can be found inbuild/helloworld_rosjava_messages/helloworld_msgs/src/main/java/helloworĺd_msgs)also, the maven artifact can be redirected from
devel/share/maven/org/ros/rosjava_messages/helloworld_msgsto~/.m2/repository/org/ros/rosjava_messages/helloworld_msgsby settingexport ROS_MAVEN_DEPLOYMENT_REPOSITORY=~/.m2/repositoryTest2: fmessmer/helloworld_rosjava_messages@26a4b31
adding a
sub_msgspackage and using it withinHelloWorldSub.actionin fmessmer/helloworld_rosjava_messages@26a4b31, no java files (not even forHelloWorld.action- which worked in Test1) are generated forhelloworld_msgsanymore, i.e. there is nosrcfolder inbuild/helloworld_rosjava_messages/helloworld_msgs...the java classes for
sub_msgsare generated successfullySo it seems, it's not the messages/actions being located in the same workspace as
rosjava_bootstrapetc. but the dependencies not being considered correctly (?)exo-core commentedon Sep 3, 2018
Hi @fmessmer,
I've tried to reproduce your example. What I did:
test_wscd test_wsrosinstall src https://raw.githubusercontent.com/fmessmer/helloworld_rosjava_messages/master/.travis.rosinstalltest_ws/src/helloworld_rosjava_messagescatkin buildAfter that I checked
test_ws/devel/share/maven/org/ros/rosjava_messagesfor the generated*.jarfiles and it looks fine for both packages. Also the content oftest_ws/devel/share/maven/org/ros/rosjava_messages/helloworld_msgs/0.0.0/helloworld_msgs-0.0.0.jarlooks fine to me:What am I missing? Do we need to have a copy of that file in another directory?
fmessmer commentedon Sep 3, 2018
@exo-core
you are right...it seems to work as long as `ROS_MAVEN_DEPLOYMENT_REPOSITORY``is not set...
(maybe the location is hard-coded at some lines of code so this feature cannot be used correctly to freely specify the maven target destination)
let me have another look at this...but it won't be before Wednesday
fmessmer commentedon Sep 4, 2018
hmm, I can't get it to work...but I don't think it's (just) the message generation for actions...
here is what I found out:
as long as
ROS_MAVEN_DEPLOYMENT_REPOSITORYis not set (or set to.../devel/share/mavenboth the jar and the pom files are generated correctly under.../devel/share/maven/...I also managed to redirect my local maven repository (default:
~/.m2/repository) to the same.../devel/share/maven/...by adding the following~/.m2/settings.xmlby doing so, everything happens in
.../devel/share/maven/...and I can compile my project locallyhowever, I'm having problems to get this set up in TravisCI using
industrial_ciI just can't figure out why it is so difficult to tell
rosjavato deploy/install to~/.m2/repository?apparently, setting
ROS_MAVEN_DEPLOYMENT_REPOSITORYdoes not work...@exo-core @jubeira: can you confirm this?
I also found this, so there seems to be a
gradletask that deploys/installs to~/.m2/repository(i.e. default maven local repository)but I don't know where I have to add this
installtask so that it gets executed when runningcatkin buildinstead,
installDistseems to be the default task which deploys/installs to.../devel/share/maven...one more thing:
having compiled my workspace as described above, i.e. all in
.../devel/share/maven/..., I can go to.../build/<one_of_my_msg_packages>and execute.gradlew installthere afterwards to get the jar and the pom installed to~/.m2/repository....but I need this to be done thrughoutcatkin buildalready...I appreciate any help/pointer!
fmessmer commentedon Sep 14, 2018
I think I found a solution for my problem....
fmessmer commentedon Sep 15, 2018
in case anyone is interested...
these are the changes I did on our forks:
rosjava/genjava#18
rosjava/rosjava_build_tools#37