scene_test.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import rospy
4 from moveit_commander import PlanningSceneInterface
5 from geometry_msgs.msg import PoseStamped
6 
8  def __init__(self):
9  rospy.init_node('scene_test')
10  self._psi = PlanningSceneInterface()
11  self._base_frame = 'base_link'
12 
13  def add_box(self, name, size, pose, orientation=[0, 0, 0, 1]):
14  pose = self.make_pose(pose, orientation)
15  return self._psi.add_box(name, pose, size)
16 
17  def make_pose(self, pose, orientation):
18  ps = PoseStamped()
19  ps.header.frame_id = self._base_frame
20  ps.pose.position.x = pose[0]
21  ps.pose.position.y = pose[1]
22  ps.pose.position.z = pose[2]
23  ps.pose.orientation.x = orientation[0]
24  ps.pose.orientation.y = orientation[1]
25  ps.pose.orientation.z = orientation[2]
26  ps.pose.orientation.w = orientation[3]
27 
28  return ps
29 
30 
31 
32 if __name__ == '__main__':
34 
35  rospy.sleep(1)
36  #obj = si.add_box('my_box3', [2, 0.05, 1.16], [0, -0.55, 1.16/2-0.32])
37  obj = si.add_box('wall1', [2, 0.05, 1.16], [2.0/2-0.65, -0.55, 1.16/2-0.32])
38  obj = si.add_box('wall2', [0.05, 3, 1.16], [-0.65, 3.0/2-0.55, 1.16/2-0.32])
39  obj = si.add_box('arm_mount1', [1, 0.2, 0.32], [0, 0, -0.32/2])
40  obj = si.add_box('arm_mount2', [1, 0.2, 0.32], [0, 0.81, -0.32/2])
41  obj = si.add_box('camera_mount1', [0.19, 0.19, 0.2], [-0.45, 0.2, -0.2/2])
42  obj = si.add_box('camera_mount2', [0.19, 0.19, 0.2], [-0.45, 0.61, -0.2/2])
43  obj = si.add_box('roomba', [0.45, 0.50, 0.23], [0, 0.40, 0.23/2-0.32])
44  obj = si.add_box('floor', [2, 3, 0.01], [1-0.65, 3.0/2-0.55, -0.3205])
45 
def add_box(self, name, size, pose, orientation=[0)
Definition: scene_test.py:13
def make_pose(self, pose, orientation)
Definition: scene_test.py:17


fsrobo_r_driver
Author(s): F-ROSROBO
autogenerated on Sun Feb 9 2020 03:58:29