services.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:APEX 作者: ymollard 项目源码 文件源码
def __init__(self):
        self.topics = {
            "ball": {"topic": "environment/ball", "sub": None, "data": CircularState(), "type": CircularState},
            "light": {"topic": "environment/light", "sub": None, "data": UInt8(), "type": UInt8},
            "sound": {"topic": "environment/sound", "sub": None, "data": Float32(), "type": Float32},
            "ergo_state": {"topic": "ergo/state", "sub": None, "data": CircularState(), "type": CircularState},
            "joy1": {"topic": "sensors/joystick/1", "sub": None, "data": Joy(), "type": Joy},
            "joy2": {"topic": "sensors/joystick/2", "sub": None, "data": Joy(), "type": Joy},
            "torso_l_j": {"topic": "{}/joint_state".format("poppy_torso"), "sub": None, "data": JointState(), "type": JointState},
            "torso_l_eef": {"topic": "{}/left_arm/end_effector_pose".format("poppy_torso"), "sub": None, "data": PoseStamped(), "type": PoseStamped},
            "torso_r_eef": {"topic": "{}/right_arm/end_effector_pose".format("poppy_torso"), "sub": None, "data": PoseStamped(), "type": PoseStamped}
        }

        self.topics["ball"]["sub"] = rospy.Subscriber(self.topics["ball"]["topic"], self.topics["ball"]["type"], self.cb_ball)
        self.topics["light"]["sub"] = rospy.Subscriber(self.topics["light"]["topic"], self.topics["light"]["type"], self.cb_light)
        self.topics["sound"]["sub"] = rospy.Subscriber(self.topics["sound"]["topic"], self.topics["sound"]["type"], self.cb_sound)
        self.topics["ergo_state"]["sub"] = rospy.Subscriber(self.topics["ergo_state"]["topic"], self.topics["ergo_state"]["type"], self.cb_ergo)
        self.topics["joy1"]["sub"] = rospy.Subscriber(self.topics["joy1"]["topic"], self.topics["joy1"]["type"], self.cb_joy1)
        self.topics["joy2"]["sub"] = rospy.Subscriber(self.topics["joy2"]["topic"], self.topics["joy2"]["type"], self.cb_joy2)
        self.topics["torso_l_j"]["sub"] = rospy.Subscriber(self.topics["torso_l_j"]["topic"], self.topics["torso_l_j"]["type"], self.cb_torso_l_j)
        self.topics["torso_l_eef"]["sub"] = rospy.Subscriber(self.topics["torso_l_eef"]["topic"], self.topics["torso_l_eef"]["type"], self.cb_torso_l_eef)
        self.topics["torso_r_eef"]["sub"] = rospy.Subscriber(self.topics["torso_r_eef"]["topic"], self.topics["torso_r_eef"]["type"], self.cb_torso_r_eef)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号