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

Remove all ros::object slots in def-set-get-param-method #1060

Merged
merged 3 commits into from
Dec 12, 2019

Conversation

Affonso-Gui
Copy link
Member

Removing all ros::object slots instead of plist and _connection-header in def-set-get-param-method, so that even if definition of ros::object changes in the future this code remains functional.
jsk-ros-pkg/jsk_roseus#606

Also changing to use symbol-name instead of format. Strings get to uppercase, but since they are read-stringed afterwards should make no difference.

>>Need testing<<

Btw some random notes:

  • I'm pretty sure that string-left-trim is not the right function here, specially if rtc_name may contain underscores.

    (:get-ROSBridge-method-def-macro
    (rtc-name srv-name &optional (ros-pkg-name "hrpsys_ros_bridge"))
    (let* ((meth-name (string-left-trim "_" (string-left-trim rtc-name (string-left-trim "_" (string-left-trim "OpenHRP" srv-name)))))
    (srv-request (read-from-string (format nil "~A::~ARequest" ros-pkg-name srv-name)))
    (init-method (find-if #'(lambda (x) (eq (car x) :init)) (send (eval srv-request) :methods)))
    ;;(new-method-name (read-from-string (format nil ":~A" (string-left-trim "_" (string-left-trim rtc-name (string-left-trim "_" (string-left-trim "OpenHRP" srv-name))))))))
    (new-method-name (read-from-string (format nil ":~A" (string-left-trim "_" (string-left-trim "OpenHRP" srv-name))))))
    (if (find-method self new-method-name)
    (progn
    (warn ";; Method conflict in ROSBridge defmethod!! ;; ~A~%" srv-name)
    nil)
    `(defmethod rtm-ros-robot-interface
    (,new-method-name
    ,(append (cadr init-method) (list (list 'rosbridge-name (format nil "~AROSBridge" rtc-name))))
    (or
    (ros::service-call
    (format nil "/~A/~A" rosbridge-name ,meth-name)
    (instance ,(eval srv-request) :init ,@(mapcan #'(lambda (x) (list (caar x) (cadar x))) (cdadr init-method))))
    (error ";; service call failed (~A)" ,new-method-name)
    )
    )
    )
    )))

    function "string-trim" behaves suspiciously euslisp/EusLisp#249
    string trim is sometimes incorrect euslisp/EusLisp#336

  • (elt ":" 0) => #\:

@Affonso-Gui
Copy link
Member Author

@Naoki-Hiraoka @itohdak @mmurooka Can I ask help for testing with HRP2 simulation?

@Naoki-Hiraoka
Copy link
Contributor

:set-st-param
がシミュレーションで問題なく動くことを確認しました

@pazeshun pazeshun changed the title Remove all ros::object slots in def-set-get-param-method [WIP] Remove all ros::object slots in def-set-get-param-method Dec 11, 2019
@pazeshun
Copy link
Collaborator

pazeshun commented Dec 11, 2019

Waiting for #1080#1085

@pazeshun pazeshun added this to the 1.4.3 milestone Dec 11, 2019
@pazeshun
Copy link
Collaborator

#1085 is merged to master and master is merged to this PR.
No more WIP.

@pazeshun pazeshun changed the title [WIP] Remove all ros::object slots in def-set-get-param-method Remove all ros::object slots in def-set-get-param-method Dec 11, 2019
@pazeshun
Copy link
Collaborator

@k-okada
This PR prevents such cases as #1053
And this PR seems functional on real robot (thanks to #1075, #1079) and travis test (thanks to #1085).
Could you review this?

@k-okada k-okada merged commit a325902 into start-jsk:master Dec 12, 2019
@Affonso-Gui Affonso-Gui deleted the def-set-get-param-method branch December 13, 2019 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants