Skip to content

Instantly share code, notes, and snippets.

@Kanazawanaoaki
Last active December 29, 2021 05:34
Show Gist options
  • Save Kanazawanaoaki/a4db07e5762ae597714e71799d03d363 to your computer and use it in GitHub Desktop.
Save Kanazawanaoaki/a4db07e5762ae597714e71799d03d363 to your computer and use it in GitHub Desktop.
pickle::dump_test
#!/usr/bin/env python
import rospy
from smach_msgs.msg import SmachContainerStatus
def callback(msg):
print (pickle.loads(msg.local_data))
def listener():
rospy.init_node('dump_listener', anonymous=True)
rospy.Subscriber('/smach/container_status', SmachContainerStatus, callback)
rospy.spin()
if __name__ == '__main__':
listener()
(require :pickle "package://roseus_smach/src/pickle.l")
(ros::roseus-add-msgs "smach_msgs")
(ros::roseus "dump_publisher")
(ros::advertise "/smach/container_status" smach_msgs::SmachContainerStatus 100)
(defun test-msg ()
(setq *msg* (instance smach_msgs::SmachContainerStatus :init))
(send *msg* :local_data (pickle::dump '((:hoge ((1 2 3) (4 5 6))))))
(ros::publish "/smach/container_status" *msg*)
)
(warn "please run (test-msg) ~%")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment