43 from sensor_msgs.msg
import JointState
53 js_pub = rospy.Publisher(
'/joint_states', JointState, queue_size=1000)
56 rospack = rospkg.RosPack()
57 ws_data_path = rospack.get_path(
'velma_kinematics') +
'/data/workspace/' 58 ws_param_filename = ws_data_path +
'lwr_ws_param.npy' 59 ws_filename = ws_data_path +
'lwr_ws.npy' 63 js_msg.name.append(
'{}_arm_{}_joint'.format(arm_name, i))
64 js_msg.position.append(0.0)
65 js_msg.name.append(
'torso_0_joint')
66 js_msg.position.append(0.0)
70 ws = LWRWorkspace.generate()
71 ws.save(ws_param_filename, ws_filename)
73 ws = LWRWorkspace.load(ws_param_filename, ws_filename)
76 x_range = list(range(ws.getCellsX()))
77 y_range = list(range(ws.getCellsY()))
78 z_range = list(range(ws.getCellsZ()))
82 if slice_coord ==
'x':
83 ic_cells = ws.getCellsX()
84 elif slice_coord ==
'y':
85 ic_cells = ws.getCellsY()
86 elif slice_coord ==
'z':
87 ic_cells = ws.getCellsZ()
90 while not rospy.is_shutdown():
92 if slice_coord ==
'x':
94 elif slice_coord ==
'y':
96 elif slice_coord ==
'z':
102 pt = PyKDL.Vector( ws.getCellCenterX(ix), ws.getCellCenterY(iy),
103 ws.getCellCenterZ(iz))
104 col = ws.getCellValue(ix, iy, iz)
106 size = ws.getCellSize()
107 m_id = m_pub.addSinglePointMarker(pt, m_id, r=col, g=col, b=col, a=1,
108 namespace=
'default', frame_id=
'calib_{}_arm_base_link'.format(arm_name),
109 m_type=Marker.CUBE, scale=Vector3(size, size, size), T=
None)
114 js_msg.header.stamp = rospy.Time.now()
115 js_pub.publish(js_msg)
122 rospy.init_node(
'test_lwr_workspace', anonymous=
False)
125 if __name__ ==
"__main__":
This class is an interface to ROS markers publisher.