43 from sensor_msgs.msg
import JointState
50 js_pub = rospy.Publisher(
'/joint_states', JointState, queue_size=1000)
53 rospack = rospkg.RosPack()
54 ws_data_path = rospack.get_path(
'velma_kinematics') +
'/data/workspace/' 55 ws_param_filename = ws_data_path +
'velma_ws_param.npy' 56 ws_filename = ws_data_path +
'velma_ws.npy' 61 js_msg.name.append(
'{}_arm_{}_joint'.format(arm_name, i))
62 js_msg.position.append(0.0)
63 js_msg.name.append(
'torso_0_joint')
64 js_msg.position.append(0.0)
68 ws = VelmaWorkspace.generate()
69 ws.save(ws_param_filename, ws_filename)
71 ws = VelmaWorkspace.load(ws_param_filename, ws_filename)
74 x_range = list(range(ws.getCellsX()))
75 y_range = list(range(ws.getCellsY()))
76 z_range = list(range(ws.getCellsZ()))
80 if slice_coord ==
'x':
81 ic_cells = ws.getCellsX()
82 elif slice_coord ==
'y':
83 ic_cells = ws.getCellsY()
84 elif slice_coord ==
'z':
85 ic_cells = ws.getCellsZ()
88 while not rospy.is_shutdown():
90 if slice_coord ==
'x':
92 elif slice_coord ==
'y':
94 elif slice_coord ==
'z':
100 pt = PyKDL.Vector( ws.getCellCenterX(ix), ws.getCellCenterY(iy),
101 ws.getCellCenterZ(iz))
102 col = ws.getCellValue(ix, iy, iz)
104 size = ws.getCellSize()
105 m_id = m_pub.addSinglePointMarker(pt, m_id, r=col, g=col, b=col, a=1,
106 namespace=
'default', frame_id=
'torso_base',
107 m_type=Marker.CUBE, scale=Vector3(size, size, size), T=
None)
112 js_msg.header.stamp = rospy.Time.now()
113 js_pub.publish(js_msg)
120 rospy.init_node(
'test_velma_workspace', anonymous=
False)
123 if __name__ ==
"__main__":
This class is an interface to ROS markers publisher.