footstep_sample.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 FRAME_ID = "/map"
4 
5 from jsk_footstep_msgs.msg import Footstep, FootstepArray
6 
7 import rospy
8 
9 def main():
10  pub = rospy.Publisher("/footsteps", FootstepArray)
11  r = rospy.Rate(3)
12  ysize = 0
13  zpos = 0
14  while not rospy.is_shutdown():
15  msg = FootstepArray()
16  now = rospy.Time.now()
17  msg.header.frame_id = FRAME_ID
18  msg.header.stamp = now
19  xpos = 0
20 
21  for i in range(20):
22  footstep = Footstep()
23  if i % 2 == 0:
24  footstep.leg = Footstep.LEFT
25  footstep.pose.position.y = 0.21
26  else:
27  footstep.leg = Footstep.RIGHT
28  footstep.pose.position.y = -0.21
29  footstep.pose.orientation.w = 1.0
30  footstep.pose.position.x = xpos
31  footstep.pose.position.z = zpos
32  footstep.dimensions.x = 0.25
33  footstep.dimensions.y = 0.15
34  footstep.dimensions.z = 0.01
35  footstep.footstep_group = i / 5
36  msg.footsteps.append(footstep)
37  xpos = xpos + 0.25
38  zpos = zpos + 0.1
39  ysize = ysize + 0.01
40  if ysize > 0.15:
41  ysize = 0.0
42  if zpos > 0.5:
43  zpos = 0.0
44  pub.publish(msg)
45  r.sleep()
46 
47 if __name__ == "__main__":
48  rospy.init_node("footstep_sample")
49  main()
50 


jsk_rviz_plugins
Author(s): Kei Okada , Yohei Kakiuchi , Shohei Fujii , Ryohei Ueda
autogenerated on Sat Mar 20 2021 03:03:18