webots_ros2
Exemple e-puck2 with a camera of 640x480
install ROS2 ( at the moment the latest is Jazzy vesion https://docs.ros.org/en/jazzy/index.html ) install all the package needed.
launch webots with world/e-puck2.wbt
With ros2 topic list
you can see the topics available:
/camera/image_raw #image from the camera
/cmd_vel #Speed command of the robot
/distance_sensors #array of floats distances from the sensors
/odom #Position of the robot as the integration of the wheel's movements
/parameter_events
/rosout
You can see and modify these values with rqt ot through your one program.
With ros2 on OSX
Install ros2 with robostack https://robostack.github.io/GettingStarted.html ( probably replace humble by jazzy to have the latest version )
Install the needed packages like rclpy : conda install -c ros-forge ros-humble-rclpy
conda install -c ros-forge ros-humble-sensor-msgs ros-humble-cv-bridge ros-humble-nav-msgs opencv ros-humble-cv-bridge
...
Launch Webot in your conda environment with ros2 activated i.e.:
conda activate ros2
/Applications/Webots.app/Contents/MacOS/webots
Open the world file world/e-puck2.wbt
and run the simulation see above.