I’m trying to use the Python OpenCV script in flytsim, and I don’t know how to use the camera in flytsim on the drones simulator. I always have a USB webcam on my computer.
Configure FlytSim in PX4(Gazebo) mode. Click here to know how.
You won’t be able to access USB webcam in the simulation environment. Instead, we have a camera simulated within the environment. To access the camera, you need to subscribe to rostopic:
Thank you for your advice
I also found an easy way to use the camera.
cam = (“http://localhost:8080/stream?topic=/flytsim/flytcam/image_capture&width=320&height=240&type=ros_compressed”)
cap = cv2.VideoCapture(cam)