Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid name clashing in ros msg packages #609

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions roseus/euslisp/roseus.l
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,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))))
Expand Down Expand Up @@ -430,7 +430,7 @@ always the rank of list is 2"
(defun ros::load-ros-package (pkg)
"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)))
Expand Down
1 change: 1 addition & 0 deletions roseus/msg/TestName.msg
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
roseus/StringStamped name
roseus/String string
19 changes: 13 additions & 6 deletions roseus/test/test-name-pub.l
Original file line number Diff line number Diff line change
Expand Up @@ -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)))

5 changes: 4 additions & 1 deletion roseus/test/test-name-sub.l
Original file line number Diff line number Diff line change
@@ -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)))
Expand Down