First you will need ros-melodic-full
installed in your computer.
Now:
sudo apt install ros-melodic-ar-track-alvar usb-cam
The first thing that we need to try is to get images from your computer and send them through ROS nodes. For this we can use the test provided by usb_cam.
roslaunch usb_cam usb_cam-test.launch
if you have multiple video devices you can choose which one to use with the video_device
option. THe default value is /dev/video0
. Here you can find an example of how to run the test for another video device:
roslaunch usb_cam usb_cam-test.launch video_device:=/dev/video1
For more information about usb_cam node options visit This ROS wiki page
The AR tags are black and white images with a certain pattern. The computer can use this tags to know from a 2D image the 3D position and orientation of the tag (within reasonable limits). To create your own tags:
cd ~/Pictures rosrun ar_track_alvar createMarker
If you do not want your markers inside your Pictures directory, cd
to the required dir first.