From e59b5d6584d580830a3ac3fe7c33e358b76faf62 Mon Sep 17 00:00:00 2001 From: Guilherme Affonso Date: Tue, 2 Apr 2019 16:40:18 +0900 Subject: [PATCH 1/2] Add test for #609 --- roseus/msg/TestName.msg | 1 + roseus/test/test-name-pub.l | 19 +++++++++++++------ roseus/test/test-name-sub.l | 5 ++++- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/roseus/msg/TestName.msg b/roseus/msg/TestName.msg index dce4ea5d0..5f66d96d4 100644 --- a/roseus/msg/TestName.msg +++ b/roseus/msg/TestName.msg @@ -1 +1,2 @@ roseus/StringStamped name +roseus/String string diff --git a/roseus/test/test-name-pub.l b/roseus/test/test-name-pub.l index c0367dbb4..4ef4a6925 100755 --- a/roseus/test/test-name-pub.l +++ b/roseus/test/test-name-pub.l @@ -6,11 +6,18 @@ (ros::advertise "test_name" roseus::TestName) (ros::rate 1) (setq i 0) + +;; Test for name clashing in ROS messages +;; `name' tests for name clashing in slot names +;; `string' tests for name clashing in message names + (while (ros::ok) - (setq ss (instance roseus::StringStamped :init :data (format nil "test ~A" (incf i)))) - (setq msg (instance roseus::TestName :init :name ss)) - (ros::ros-info "pub ~A" msg) - (ros::publish "test_name" msg) - (ros::sleep) - (ros::spin-once)) + (let* ((str (format nil "test ~A" (incf i))) + (s (instance roseus::String :init :data str)) + (ss (instance roseus::StringStamped :init :data str)) + (msg (instance roseus::TestName :init :name ss :string s))) + (ros::ros-info "pub ~A" msg) + (ros::publish "test_name" msg) + (ros::sleep) + (ros::spin-once))) diff --git a/roseus/test/test-name-sub.l b/roseus/test/test-name-sub.l index b7d300a22..c512bb13d 100755 --- a/roseus/test/test-name-sub.l +++ b/roseus/test/test-name-sub.l @@ -1,6 +1,9 @@ #!/usr/bin/env roseus -(ros::load-ros-manifest "roseus") +;; It is important to load `TestName.l' before `String.l' to test for name clashing +;; between roseus::String and lisp::string +(flet ((directory (dir) (list "TestName.l" "StringStamped.l" "String.l"))) + (ros::roseus-add-files "roseus" "msg")) (ros::roseus "test_name_sub") (ros::subscribe "test_name" roseus::TestName #'(lambda (msg) (ros::ros-info "sub ~A" msg))) From b926d5a443d4432852396144d708afc362f4aac0 Mon Sep 17 00:00:00 2001 From: Guilherme Affonso Date: Tue, 2 Apr 2019 15:46:13 +0900 Subject: [PATCH 2/2] Avoid name clashing in ros msg packages --- roseus/euslisp/roseus.l | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roseus/euslisp/roseus.l b/roseus/euslisp/roseus.l index 0bc1a46bb..54dc672bd 100644 --- a/roseus/euslisp/roseus.l +++ b/roseus/euslisp/roseus.l @@ -199,7 +199,7 @@ (exit 1)) (ros::ros-debug "Loading ~A" dir) (unless (find-package (string-upcase pkg)) - (make-package (string-upcase pkg))) + (make-package (string-upcase pkg) :use nil)) (dolist (file (directory dir)) (when (and (string= (pathname-type file) "l") (not (= #\. (elt (pathname-name file) 0)))) @@ -406,9 +406,9 @@ always the rank of list is 2" (ros::ros-error "Could not find ~A~%try rosrun roseus generate-all-msg-srv.sh ~A" manifest pkg))))) (defun ros::load-ros-package (pkg) - "load reqruied roseus files for given package" + "load required roseus files for given package" (unless (find-package (string-upcase pkg)) - (make-package (string-upcase pkg))) + (make-package (string-upcase pkg) :use nil)) (when (probe-file (format nil "~A/msg" (ros::find-load-msg-path pkg))) (ros::roseus-add-msgs pkg)) (when (probe-file (format nil "~A/srv" (ros::find-load-msg-path pkg)))