4 from hrpsys_ros_bridge.msg
import ContactState, ContactStateStamped, ContactStatesStamped
5 from random
import random
6 if __name__ ==
"__main__":
7 rospy.init_node(
"contact_state_sample")
8 pub = rospy.Publisher(
"~output", ContactStatesStamped)
9 link_names = rospy.get_param(
"~links", [
"r_shoulder_pan_link"])
11 while not rospy.is_shutdown():
12 states = ContactStatesStamped()
13 states.header.stamp = rospy.Time.now()
14 for link_name
in link_names:
15 state = ContactStateStamped()
16 state.header.frame_id = link_name
17 state.header.stamp = rospy.Time.now()
19 state.state.state = ContactState.ON
21 state.state.state = ContactState.OFF
22 states.states.append(state)