Welcome to ROSMASTER X3 Plus repository
7. Web page real-time monitoring
7. Web page real-time monitoring
7.1. Environment Construction
sudo apt-get install ros-noetic-async-web-server-cpp ros-noetic-web-video-server ros-noetic-usb-cam
First, make sure the USB camera is connected correctly. Enter the following command to check that the USB device number exists and is video0.
xxxxxxxxxxll /dev
If the execution permission is not enough, you need to add execution permission
xxxxxxxxxxsudo chmod 777 /dev/video*
7.2. modify the launch file
xxxxxxxxxxsudo vim /opt/ros/noetic/share/usb_cam/launch/usb_cam-test.launch
Keep clicking [d] on the keyboard to delete everything. Click [i] on the keyboard to enter editing mode and write the following content into it.
xxxxxxxxxx<launch> <arg name="open_view" default="false"/> <node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen"> <param name="video_device" value="/dev/video0"/> <param name="image_width" value="640"/> <param name="image_height" value="480"/> <param name="pixel_format" value="yuyv"/> <param name="camera_frame_id" value="usb_cam"/> <param name="io_method" value="mmap"/> </node> <!-- web_video_server --> <node pkg="web_video_server" type="web_video_server" name="web_video_server" output="screen"/> <!-- image_view --> <group if="$(arg open_view)"> <node name="image_view" pkg="image_view" type="image_view" respawn="false" output="screen"> <remap from="image" to="/usb_cam/image_raw"/> <param name="autosize" value="true"/> </node> </group></launch>Click the [ESC] key twice (or multiple times), click the keyboard [shift + ;], enter [wq], and click the [Enter] key.
7.3. effect demonstration
Open the terminal and start
xxxxxxxxxxroslaunch usb_cam usb_cam-test.launch
- View in local web browser
xxxxxxxxxxhttp://localhost:8080/
- View on other devices (must be in the same LAN, 192.168.2.93 is the IP address of the master)
xxxxxxxxxxhttp://192.168.2.93:8080/
Note: It is recommended to use Google Chrome or mobile QQ browser, other browsers may not be able to open the image

Click [image_raw] to view the camera image in real time, click [Snapshot] to display only one frame of image.