ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Realtime code sharing on multiple hosts w/o caring host-specifics (e.g. CPU architecture)

asked 2011-10-24 07:12:53 -0500

130s gravatar image

updated 2011-10-24 08:12:45 -0500

In ROS (or in general C++, or even other language), is there a better way to achieve what I describe below? Thanks.

When I share the project/stack/package folders using file sharing tools (e.g. Dropbox, MobileMe, WinSCP etc.), I can build on Host-2 right after I modified the codes on Host-1. Very comfortable esp. when I have a reason to use multiple machines.

Although I can even run the binary on Host-2, this is true only when the computer architecture is the same. For example, suppose Host-1 is 64 bit and Host-2 is 32, the binary originally created on Host-1 doesn't run on Host-2 even though it's copied by file sharing right after it's generated on Host-1. So on Host-2 I need to build again. However, by the time building is done, then the binary on Host-1 is re-written as 32-bit by the file sharing tool. And this chicken race goes on and on...

So when on different architecture, I need certain workaround if I persist to use file sharing.

My current solution is to create a folder that's not shared, put the binary files into the folder, and make a shell script that calls that binary (.launch file might be able to replace this but I haven't tried). In this way, though I can't call the binary file by rosrun any more, instead I can save much time that were supposed to be spent on re-build that I described an example earlier. There could still be host-specific information especially in the path of the binary file (since I no longer call by rosrun which uses stack/package info instead of path), but I work around it by using the environment variables that I additionally made. Example:

/home/ros_great/ROS_Workspace/HostSpecific/bin    # storage of binary files
$ROS_CUSTOM_PACKAGE_BIN = /home/ros_great/ROS_Workspace/HostSpecific/bin

A shell script example:


In this way, I need to do some additional tasks initially when I start working on a package, but still I can cut down much time. Since using multiple computers might be common, I wonder if ROS has already similar/better functionality. For instance, rosmake generating binary in the location specified CMakeLists.txt then roslaunch calling the binary from that location automatically.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2011-10-26 10:18:02 -0500

Mac gravatar image

If you're using machines with different architectures, you're going to have to recompile anyway; it seems to me that version control is, in general, the right answer here. That is:

  1. Hack until you want to try something.
  2. Check it in.
  3. Check it out on the other machine and build it (this could be scripted to all happen in one step)

...and iterate. This has the added benefit of making you check in a lot, which is good programming practice, and keeps you from clobbering different builds of your various binaries.

It's not quite as fast, but (at least in the different-architecture case) you're never going to win, anyway.

edit flag offensive delete link more

answered 2011-10-27 09:28:33 -0500

John Hoare gravatar image

I'm sure how you go about doing this would differ depending on what program you're using, but I would imagine there is some way to "ignore" certain files/folders and then you should set the build directories and bin directories to be ignored, that way you can build it on each machine and it won't propigate to the other machines.

That said, I use Mac's solution myself, but if you want to continue using what you're using I think my answer is the way to go, assuming it is supported by whatever software you are using.

edit flag offensive delete link more


Dropbox, I'm told, has a "selective sync" capability that does this. I like my actual answer better, of course, but the original poster mentioned Dropbox, so I figured I'd point this out.
Mac gravatar image Mac  ( 2011-10-28 08:51:28 -0500 )edit

Question Tools


Asked: 2011-10-24 07:12:53 -0500

Seen: 427 times

Last updated: Oct 27 '11