diff --git a/CMakeLists.txt b/CMakeLists.txt index 0be0c2913..b4f873d67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ # CMake ############################################################################## -cmake_minimum_required(VERSION 2.8.3) +cmake_minimum_required(VERSION 3.0.2) project(rosjava_core) ############################################################################## @@ -30,5 +30,5 @@ catkin_package() # Installation ############################################################################## -install(DIRECTORY ${CATKIN_DEVEL_PREFIX}/${CATKIN_GLOBAL_MAVEN_DESTINATION}/org/ros/rosjava_core/ +install(DIRECTORY ${ROS_MAVEN_DEPLOYMENT_REPOSITORY}/org/ros/rosjava_core/ DESTINATION ${CATKIN_GLOBAL_MAVEN_DESTINATION}/org/ros/rosjava_core) diff --git a/apache_xmlrpc_common/build.gradle b/apache_xmlrpc_common/build.gradle index 49b9f4a9b..04f5d9872 100644 --- a/apache_xmlrpc_common/build.gradle +++ b/apache_xmlrpc_common/build.gradle @@ -17,5 +17,6 @@ dependencies { compile 'org.apache.commons:com.springsource.org.apache.commons.httpclient:3.1.0' compile 'org.apache.ws.commons:ws-commons-util:1.0.1' + compile 'javax.xml.bind:jaxb-api:2.3.1' } diff --git a/build.gradle b/build.gradle index 4f62fac06..9a30436de 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,12 @@ task wrapper(type: Wrapper) { } buildscript { - apply from: "https://github.com/rosjava/rosjava_bootstrap/raw/kinetic/buildscript.gradle" + try{ + apply from: "https://raw.githubusercontent.com/mojin-robotics/rosjava_bootstrap/kinetic/buildscript.gradle" + } catch (all) { + //local copy of rosjava_bootstrap buildscript.gradle + apply from: "buildscript.gradle" + } } apply plugin: "catkin" diff --git a/buildscript.gradle b/buildscript.gradle new file mode 100644 index 000000000..30de54292 --- /dev/null +++ b/buildscript.gradle @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2014 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +/* + * @fmessmer: + * This file is a copy from https://raw.githubusercontent.com/mojin-robotics/rosjava_bootstrap/kinetic/buildscript.gradle + * It is copied to allow temporary offline compilation + */ + +rootProject.buildscript { + String rosMavenPath = System.getenv("ROS_MAVEN_PATH") + String rosMavenRepository = System.getenv("ROS_MAVEN_REPOSITORY") + repositories { + if (rosMavenPath != null) { + rosMavenPath.tokenize(":").each { path -> + maven { + // We can't use uri() here because we aren't running inside something + // that implements the Script interface. + url "file:${path}" + } + } + } + maven { + url "http://repository.springsource.com/maven/bundles/release" + } + maven { + url "http://repository.springsource.com/maven/bundles/external" + } + if (rosMavenRepository != null) { + maven { + url rosMavenRepository + } + } + maven { + url "https://github.com/rosjava/rosjava_mvn_repo/raw/master" + } + jcenter() + } + dependencies { + classpath "org.ros.rosjava_bootstrap:gradle_plugins:[0.3,0.4)" + } +} diff --git a/rosjava/test/test_composite_passthrough.py b/rosjava/test/test_composite_passthrough.py index 53ea068ac..b8a1da1ef 100755 --- a/rosjava/test/test_composite_passthrough.py +++ b/rosjava/test/test_composite_passthrough.py @@ -67,37 +67,37 @@ def cb_from_test(self, msg): def test_composite_passthrough(self): # 20 seconds to validate fixture timeout_t = time.time() + 20. - print "waiting for 20 seconds for fixture to verify" + print("waiting for 20 seconds for fixture to verify") while self.fixture_curr is None and \ not rospy.is_shutdown() and \ timeout_t > time.time(): time.sleep(0.2) - self.failIf(timeout_t < time.time(), "timeout exceeded") - self.failIf(rospy.is_shutdown(), "node shutdown") - self.failIf(self.fixture_curr is None, "no data from fixture") + self.assertFalse(timeout_t < time.time(), "timeout exceeded") + self.assertFalse(rospy.is_shutdown(), "node shutdown") + self.assertFalse(self.fixture_curr is None, "no data from fixture") m = self.fixture_curr - self.assertAlmostEquals(m.a.x, m.b.x) - self.assertAlmostEquals(m.a.y, m.b.y) - self.assertAlmostEquals(m.a.z, m.b.z) + self.assertAlmostEqual(m.a.x, m.b.x) + self.assertAlmostEqual(m.a.y, m.b.y) + self.assertAlmostEqual(m.a.z, m.b.z) # another 20 seconds to validate client timeout_t = time.time() + 20. - print "waiting for 20 seconds for client to verify" + print("waiting for 20 seconds for client to verify") while self.test_curr is None and \ not rospy.is_shutdown() and \ timeout_t > time.time(): time.sleep(0.2) - self.failIf(self.test_curr is None, "no data from test") + self.assertFalse(self.test_curr is None, "no data from test") m = self.test_curr - self.assertAlmostEquals(m.a.x, m.b.x) - self.assertAlmostEquals(m.a.y, m.b.y) - self.assertAlmostEquals(m.a.z, m.b.z) + self.assertAlmostEqual(m.a.x, m.b.x) + self.assertAlmostEqual(m.a.y, m.b.y) + self.assertAlmostEqual(m.a.z, m.b.z) # a.w = a.x + a.y + a.z. Just make sure we're in the ballpark a = self.test_curr.a - self.assert_(abs(a.x + a.y + a.z - a.w) < 10.) + self.assertTrue(abs(a.x + a.y + a.z - a.w) < 10.) if __name__ == '__main__': import rostest diff --git a/rosjava/test/test_int64_passthrough.py b/rosjava/test/test_int64_passthrough.py index 17d2278fd..164a91295 100755 --- a/rosjava/test/test_int64_passthrough.py +++ b/rosjava/test/test_int64_passthrough.py @@ -70,28 +70,28 @@ def cb_from_test(self, msg): def test_int64_passthrough(self): # 20 seconds to validate fixture timeout_t = time.time() + 20. - print "waiting for 20 seconds for fixture to verify" + print("waiting for 20 seconds for fixture to verify") while self.fixture_prev is None and \ not rospy.is_shutdown() and \ timeout_t > time.time(): time.sleep(0.2) - self.failIf(timeout_t < time.time(), "timeout exceeded") - self.failIf(rospy.is_shutdown(), "node shutdown") - self.failIf(self.fixture_prev is None, "no data from fixture") - self.failIf(self.fixture_curr is None, "no data from fixture") - self.assertEquals(self.fixture_prev.data + 1, self.fixture_curr.data, "fixture should incr by one") + self.assertFalse(timeout_t < time.time(), "timeout exceeded") + self.assertFalse(rospy.is_shutdown(), "node shutdown") + self.assertFalse(self.fixture_prev is None, "no data from fixture") + self.assertFalse(self.fixture_curr is None, "no data from fixture") + self.assertEqual(self.fixture_prev.data + 1, self.fixture_curr.data, "fixture should incr by one") # another 20 seconds to validate client timeout_t = time.time() + 20. - print "waiting for 20 seconds for client to verify" + print("waiting for 20 seconds for client to verify") while self.test_prev is None and \ not rospy.is_shutdown() and \ timeout_t > time.time(): time.sleep(0.2) - self.failIf(self.test_prev is None, "no data from test") - self.assertEquals(self.test_prev.data + 1, self.test_curr.data, "test does not appear to match fixture data") + self.assertFalse(self.test_prev is None, "no data from test") + self.assertEqual(self.test_prev.data + 1, self.test_curr.data, "test does not appear to match fixture data") if __name__ == '__main__': diff --git a/rosjava/test/test_parameter_client.py b/rosjava/test/test_parameter_client.py index 85ee40613..fddd97834 100755 --- a/rosjava/test/test_parameter_client.py +++ b/rosjava/test/test_parameter_client.py @@ -85,7 +85,7 @@ def tilde_cb(self, msg): def test_parameter_client_read(self): timeout_t = time.time() + 20. - print "waiting for 20 seconds for client to load" + print("waiting for 20 seconds for client to load") tests = self.tests msgs = [None] @@ -95,36 +95,36 @@ def test_parameter_client_read(self): time.sleep(0.2) msgs = [getattr(self, t+'_msg') for t in tests] - print "msgs: %s"%(msgs) + print("msgs: %s"%(msgs)) - self.failIf(timeout_t < time.time(), "timeout exceeded") - self.failIf(rospy.is_shutdown(), "node shutdown") - self.failIf(any(1 for m in msgs if m is None), "did not receive all expected messages: "+str(msgs)) + self.assertFalse(timeout_t < time.time(), "timeout exceeded") + self.assertFalse(rospy.is_shutdown(), "node shutdown") + self.assertFalse(any(1 for m in msgs if m is None), "did not receive all expected messages: "+str(msgs)) ns = rospy.get_param('parameter_namespace') for t in tests: p_name = roslib.names.ns_join(ns, t) value = rospy.get_param(p_name, t) msg = getattr(self, "%s_msg"%(t)) - print "get param: %s"%(p_name) - print "param value: %s"%(value) - print "msg value: %s"%(msg) + print("get param: %s"%(p_name)) + print("param value: %s"%(value)) + print("msg value: %s"%(msg)) if t == 'composite': - print "value", p_name, value + print("value", p_name, value) m = Composite(CompositeA(**value['a']), CompositeB(**value['b'])) - self.assertAlmostEquals(m.a.x, msg.a.x) - self.assertAlmostEquals(m.a.y, msg.a.y) - self.assertAlmostEquals(m.a.z, msg.a.z) - self.assertAlmostEquals(m.a.w, msg.a.w) - self.assertAlmostEquals(m.b.x, msg.b.x) - self.assertAlmostEquals(m.b.y, msg.b.y) - self.assertAlmostEquals(m.b.z, msg.b.z) + self.assertAlmostEqual(m.a.x, msg.a.x) + self.assertAlmostEqual(m.a.y, msg.a.y) + self.assertAlmostEqual(m.a.z, msg.a.z) + self.assertAlmostEqual(m.a.w, msg.a.w) + self.assertAlmostEqual(m.b.x, msg.b.x) + self.assertAlmostEqual(m.b.y, msg.b.y) + self.assertAlmostEqual(m.b.z, msg.b.z) elif t == 'list': - self.assertEquals(list(value), list(msg.int32_array)) + self.assertEqual(list(value), list(msg.int32_array)) elif t == 'float': - self.assertAlmostEquals(value, msg.data) + self.assertAlmostEqual(value, msg.data) else: - self.assertEquals(value, msg.data) + self.assertEqual(value, msg.data) def test_set_parameter(self): # make sure client copied each parameter correct @@ -137,23 +137,23 @@ def test_set_parameter(self): source_value = rospy.get_param(source_name) target_value = rospy.get_param(target_name) if t != 'float': - self.assertEquals(source_value, target_value) + self.assertEqual(source_value, target_value) else: - self.assertAlmostEquals(source_value, target_value) + self.assertAlmostEqual(source_value, target_value) def test_tilde_parameter(self): timeout_t = time.time() + 20. - print "waiting for 20 seconds for client to load" + print("waiting for 20 seconds for client to load") while self.tilde_msg is None and \ not rospy.is_shutdown() and \ timeout_t > time.time(): time.sleep(0.2) - self.failIf(timeout_t < time.time(), "timeout exceeded") - self.failIf(rospy.is_shutdown(), "node shutdown") - self.failIf(self.tilde_msg is None) + self.assertFalse(timeout_t < time.time(), "timeout exceeded") + self.assertFalse(rospy.is_shutdown(), "node shutdown") + self.assertFalse(self.tilde_msg is None) - self.assertEquals(rospy.get_param('param_client/tilde'), self.tilde_msg.data) + self.assertEqual(rospy.get_param('param_client/tilde'), self.tilde_msg.data) if __name__ == '__main__': import rostest diff --git a/rosjava/test/test_string_passthrough.py b/rosjava/test/test_string_passthrough.py index 67df681a3..31dee4042 100755 --- a/rosjava/test/test_string_passthrough.py +++ b/rosjava/test/test_string_passthrough.py @@ -51,7 +51,7 @@ class TestStringPassthrough(unittest.TestCase): def setUp(self): rospy.init_node(NAME) - self.nodes = ['/node%s'%(i) for i in xrange(10)] + self.nodes = ['/node%s'%(i) for i in range(10)] self.nodes_set = set(self.nodes) # keep track of nodes that have done callbacks @@ -70,31 +70,31 @@ def cb_from_test(self, msg): def test_string_passthrough(self): # 20 seconds to validate fixture timeout_t = time.time() + 20. - print "waiting for 20 seconds for fixture to verify" + print("waiting for 20 seconds for fixture to verify") while not self.fixture_nodes_cb == self.nodes_set and \ not rospy.is_shutdown() and \ timeout_t > time.time(): time.sleep(0.2) - self.failIf(timeout_t < time.time(), "timeout exceeded") - self.failIf(rospy.is_shutdown(), "node shutdown") - self.assertEquals(self.nodes_set, self.fixture_nodes_cb, "fixture did not validate: %s vs %s"%(self.nodes_set, self.fixture_nodes_cb)) + self.assertFalse(timeout_t < time.time(), "timeout exceeded") + self.assertFalse(rospy.is_shutdown(), "node shutdown") + self.assertEqual(self.nodes_set, self.fixture_nodes_cb, "fixture did not validate: %s vs %s"%(self.nodes_set, self.fixture_nodes_cb)) # another 20 seconds to validate client timeout_t = time.time() + 20. - print "waiting for 20 seconds for client to verify" + print("waiting for 20 seconds for client to verify") while not self.test_nodes_cb == self.nodes_set and \ not rospy.is_shutdown() and \ timeout_t > time.time(): time.sleep(0.2) - self.assertEquals(self.nodes_set, self.test_nodes_cb, "passthrough did not pass along all message") + self.assertEqual(self.nodes_set, self.test_nodes_cb, "passthrough did not pass along all message") # Create a new Publisher here. This will validate publisherUpdate() pub = rospy.Publisher('string_in', String) msg = 'test_publisherUpdate' timeout_t = time.time() + 20. - print "waiting for 20 seconds for client to verify" + print("waiting for 20 seconds for client to verify") while not msg in self.nodes_set and \ not rospy.is_shutdown() and \ timeout_t > time.time(): diff --git a/rosjava/test/test_testheader_passthrough.py b/rosjava/test/test_testheader_passthrough.py index b6ca6a8bb..8c6165ab7 100755 --- a/rosjava/test/test_testheader_passthrough.py +++ b/rosjava/test/test_testheader_passthrough.py @@ -67,32 +67,32 @@ def cb_from_test(self, msg): def test_testheader_passthrough(self): # 20 seconds to validate fixture timeout_t = time.time() + 20. - print "waiting for 20 seconds for fixture to verify" + print("waiting for 20 seconds for fixture to verify") while self.fixture_curr is None and \ not rospy.is_shutdown() and \ timeout_t > time.time(): time.sleep(0.2) - self.failIf(timeout_t < time.time(), "timeout exceeded") - self.failIf(rospy.is_shutdown(), "node shutdown") - self.failIf(self.fixture_curr is None, "no data from fixture") - self.assertEquals('/node0', self.fixture_curr.caller_id) - self.assertEquals('', self.fixture_curr.orig_caller_id) + self.assertFalse(timeout_t < time.time(), "timeout exceeded") + self.assertFalse(rospy.is_shutdown(), "node shutdown") + self.assertFalse(self.fixture_curr is None, "no data from fixture") + self.assertEqual('/node0', self.fixture_curr.caller_id) + self.assertEqual('', self.fixture_curr.orig_caller_id) # another 20 seconds to validate client timeout_t = time.time() + 20. - print "waiting for 20 seconds for client to verify" + print("waiting for 20 seconds for client to verify") while self.test_curr is None and \ not rospy.is_shutdown() and \ timeout_t > time.time(): time.sleep(0.2) - self.failIf(self.test_curr is None, "no data from test") - self.assertEquals('/rosjava_node', self.test_curr.caller_id) - self.assertEquals('/node0', self.test_curr.orig_caller_id) + self.assertFalse(self.test_curr is None, "no data from test") + self.assertEqual('/rosjava_node', self.test_curr.caller_id) + self.assertEqual('/node0', self.test_curr.orig_caller_id) t = self.test_curr.header.stamp.to_sec() # be really generous here, just need to be in the ballpark. - self.assert_(abs(time.time() - t) < 60.) + self.assertTrue(abs(time.time() - t) < 60.) if __name__ == '__main__': import rostest diff --git a/rosjava_benchmarks/scripts/pubsub_benchmark.py b/rosjava_benchmarks/scripts/pubsub_benchmark.py index b669f7712..5417500c9 100755 --- a/rosjava_benchmarks/scripts/pubsub_benchmark.py +++ b/rosjava_benchmarks/scripts/pubsub_benchmark.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # # Copyright (C) 2012 Google Inc. # @@ -32,7 +32,7 @@ def __init__(self): def callback(self, _): with self.lock: - self.count.next() + next(self.count) def run(self): tf_publisher = rospy.Publisher('tf', tf_msgs.tfMessage) @@ -41,7 +41,7 @@ def run(self): while not rospy.is_shutdown(): tf_publisher.publish(tf_msgs.tfMessage()) if (rospy.Time.now() - self.time) > rospy.Duration(5): - status_publisher.publish(std_msgs.String('%.2f Hz' % (self.count.next() / 5.0))) + status_publisher.publish(std_msgs.String('%.2f Hz' % (next(self.count) / 5.0))) with self.lock: self.count = itertools.count() self.time = rospy.Time.now() diff --git a/rosjava_test/scripts/serialized_message.py b/rosjava_test/scripts/serialized_message.py index 56a6340dc..9e874cc37 100644 --- a/rosjava_test/scripts/serialized_message.py +++ b/rosjava_test/scripts/serialized_message.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # # Copyright (C) 2012 Google Inc. # @@ -23,7 +23,7 @@ __author__ = 'damonkohler@google.com (Damon Kohler)' -import StringIO +import io import roslib; roslib.load_manifest('rosjava_test') import rospy @@ -31,7 +31,7 @@ import nav_msgs.msg as nav_msgs message = nav_msgs.Odometry() -buf = StringIO.StringIO() +buf = io.StringIO() message.serialize(buf) -print ''.join('0x%02x,' % ord(c) for c in buf.getvalue())[:-1] +print(''.join('0x%02x,' % ord(c) for c in buf.getvalue())[:-1])