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

tamias's profile - activity

2019-01-12 12:22:38 -0500 received badge  Nice Question (source)
2012-10-15 06:46:17 -0500 received badge  Student (source)
2012-09-11 06:37:44 -0500 received badge  Famous Question (source)
2012-09-04 02:55:22 -0500 asked a question rosjava_geometry does not exist

I've successfully followed the instructions at http://docs.rosjava.googlecode.com/hg/rosjava_core/html/index.html to build and install rosjava, and created some Nodes which run fine. I've also run 'gradle eclipse' to generate classpath entries for Eclipse, and that seems to work too.

However, Eclipse does not automatically include rosjava_geometry in the library path, and even when the rosjava_geometry JAR is manually included and can be accessed in Eclipse, running 'gradle build' on my package fails during task ':compileJava' with the compiler error 'package org.ros.rosjava_geometry does not exist'.

How can I get my installation to include rosjava_geometry correctly?

2012-08-15 22:14:24 -0500 received badge  Notable Question (source)
2012-08-15 06:01:35 -0500 received badge  Popular Question (source)
2012-08-15 00:38:31 -0500 received badge  Scholar (source)
2012-08-14 04:05:24 -0500 commented question Creating composite rosjava messages without a Node

Actually the situation is even worse than in my example code; a DefaultNode can't be instantiated directly, but rather a DefaultNodeFactory needs to be created first, then a DefaultNode created, then its own MessageFactory used to create Twist and Vector3 messages!

2012-08-14 04:03:29 -0500 received badge  Supporter (source)
2012-08-14 01:22:06 -0500 asked a question Creating composite rosjava messages without a Node

I saw that rosjava changed some months ago to define Messages as interfaces rather than instantiable classes (http://answers.ros.org/question/31399/how-do-you-construct-composite-messages-in-rosjava/). I also saw that a Node instance is now required to provide a MessageFactory so that Messages can be created (http://answers.ros.org/question/36044/declare-a-message-outside-of-a-node-scope-problems/).

I'm currently writing material for a university course in which rosjava is used. Last year the students' code to create composite messages was fairly simple, as I supplied them with an Abstract helper class and they only needed to implement methods such as:

public Twist turnLeft() {
  Twist left = new Twist();
  left.angular.z = 0.5;
  return left;
}

However, with the recent changes they now have the triple confusion of a) having to pre-define and populate a Vector3 message to be inserted into the Twist, b) create the Vector3 and a Twist message using a MessageFactory, and c) instantiate a temporary DefaultNode to get access to a MessageFactory. So the code looks like this:

public Twist turnLeft() {
  DefaultNode node = new DefaultNode(null, null, null);
  Twist left = node.getTopicMessageFactory().newFromType(Twist._TYPE);
  Vector3 move = node.getTopicMessageFactory().newFromType(Vector3._TYPE);
  move.setZ(0.5);
  left.setAngular(move);
  return left;
}

Is all the above really necessary, or have I misunderstood the way in which the MessageFactory and composite messages should work? Is there an easier / less verbose way of creating composite messages, particularly when no Node object is already present within the class?