[ros-users] ROSjava and non-standard messages

Mark Rowan m.s.rowan at cs.bham.ac.uk
Mon Aug 15 17:34:43 UTC 2011

On 15 August 2011 18:07, Ken Conley <kwc at willowgarage.com> wrote:
> On Mon, Aug 15, 2011 at 10:00 AM, Mark Rowan <m.s.rowan at cs.bham.ac.uk> wrote:
>> Ok, I've got ant working (thanks to the supplied build.xml on the
>> rosjava wiki page you linked to, although there was a small error in
>> the XML file which I've corrected on the wiki) but I can't seem to
>> find any way to run the compiled classes using rosrun. Is this
>> possible, or do we have to manually execute nodes using java
>> -classpath <path> package.class ?
> This is still be tweaked and documentation hasn't been written yet,
> but you can use:
> "
> rosrun rosjava_bootstrap run.py <pkg> <node_class>  [args ... ]
> "

Thanks for this info. I assume <pkg> relates to the ROS package, not
the Java package?

> That script generally assumes that you are using the <export> tags to
> setup your path.  These <export> tags are currently being finalized
> and you'd have to look at rosjava_core packages for examples.

My path is currently set manually in .bashrc -- is this a suitable
alternative, or are the <export> tags specifically required?

> But, the script basically constructs the path from the export tags and runs:
> java -classpath <classpath> org.ros.RosRun <node_class> [args...]
> So that should be fairly similar to what you are used to.

Thanks. I'm clearly doing something wrong, as run.py responds that it
is 'Unable to locate node'.

I have a ROS package directory, initialised with rospkg-create, and
containing 'src' and 'build' directories. The 'src' contains a further
Java package directory Running 'ant compile' takes my source and
compiles it into the build directory, at myPackage/MyClass.class .

Running 'rosrun rosjava_bootstrap run.py <ros-package>
myPackage.MyClass' builds successfully from dependencies.xml (although
it declares an error, "Could not load definitions from resource
net/sf/antcontrib/antlib.xml. It could not be found." -- is this
important?) but after the execution stage begins, the script returns
"Unable to locate node myPackage.MyClass".

The huge auto-generated classpath does not include the
<ros-package>/build/ directory, which seems relevant.

Thanks again, and sorry for the many questions!


Mark Rowan  |  http://www.tamias.co.uk

More information about the ros-users mailing list