When using Turtlebot in the lab, it only publishs the CompressedImage from '/raspicam_node/image/compressed'. Here's how to read CompressedImage and Raw if you need.
from cv_bridge import CvBridge
def __init__(self):
self.bridge = CvBridge()
def image_callback(self, msg):
# get raw image
# image = self.bridge.imgmsg_to_cv2(msg)
# get compressed image
np_arr = np.frombuffer(msg.data, np.uint8)
img_np = cv2.imdecode(np_arr, cv2.IMREAD_COLOR)
image = cv2.cvtColor(img_np, cv2.COLOR_BGR2HSV)
Limit frame rate
When the computation resource and the bandwidtn of robot are restricted, you need limit the frame rate.