Skip to content

Commit

Permalink
use subcribed msg's stamp and baxter's frame-id once to accelerate th…
Browse files Browse the repository at this point in the history
…e rate
  • Loading branch information
soonhyo kim committed Apr 18, 2024
1 parent 12b00ac commit 2321d69
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,31 @@

(if (not (boundp '*baxter*))
(setq *baxter* (instance baxter-robot :init)))
(setq frames (make-hash-table))
(dolist (arm (list :rarm :larm))
(sethash arm frames (send (send (send *baxter* arm :end-coords) :parent) :name))
)

(ros::rate 20)
(ros::rate 100)

(defun right-state-cb(msg)
(state-cb "/robot/end_effector/right/wrench" :rarm (send msg :wrench))
(state-cb "/robot/end_effector/right/wrench" :rarm (send msg :wrench) (send msg :header :stamp))
)

(defun left-state-cb(msg)
(state-cb "/robot/end_effector/left/wrench" :larm (send msg :wrench))
(state-cb "/robot/end_effector/left/wrench" :larm (send msg :wrench) (send msg :header :stamp))
)

(defun state-cb(advertise-topic arm wrench-msg)
(defun state-cb(advertise-topic arm wrench-msg stamp)
(let ((msg (instance geometry_msgs::WrenchStamped :init)))
(send msg :wrench wrench-msg)
(send msg :header :stamp (ros::time-now))
(send msg :header :frame_id (send (send (send *baxter* arm :end-coords) :parent) :name))
(send msg :header :stamp stamp)
(send msg :header :frame_id (gethash arm frames))
(ros::publish advertise-topic msg))
)


(ros::subscribe "/robot/limb/left/endpoint_state" baxter_core_msgs::EndpointState #'left-state-cb)
(ros::subscribe "/robot/limb/right/endpoint_state" baxter_core_msgs::EndpointState #'right-state-cb)

(ros::spin)
(ros::spin)

0 comments on commit 2321d69

Please sign in to comment.