Here I show how to get access to the built in webcam on a MacBook in ROS (Robot Operating System).
This post assumes you have followed these two previous posts:
1. Install Ubuntu on an external USB drive so that you can run it from your MacBook
2. Installing ROS
Update
In the terminal, run the following two commands:
$ sudo apt-get update $ sudo apt-get upgrade
Give Ubuntu access to your Mac’s webcam
From the terminal, run these commands:
$ cd /etc/local/src $ git clone https://github.com/patjak/bcwc_pcie.git $ cd bcwc_pcie/firmware $ sudo make $ sudo make install $ cd .. $ sudo make $ sudo install $ sudo depmod $ sudo modprobe -r bdc_pci $ sudo modprobe facetimehd
These instructions come from medium and askubuntu. Note: I received an error on the second install command, but it still works fine.
Test that the camera is working
Install guvcview:
$ sudo apt-get install guvcview
Then run it (by typing gucview into the terminal). If all goes well, a live view feed will pop up!
Install the usb_cam ROS driver:
To get access we will use the usb_cam driver. These steps assume that you have already built a catkin workspace, called catkin_ws.
$ cd ~/catkin_ws/src $ git clone https://github.com/ros-drivers/usb_cam.git $ cd ~/catkin $ catkin_make
Launch the camera driver / viewer
$ cd ~/catkin_ws/src/usb_cam/launch $ roslaunch usb_cam-test.launch
If all is good, a live video feed will now pop up. Note that the launch file spins up two nodes: usb_cam and image_view.
Explore the ROS topics
Type “rostopic list” into the terminal window to see a list of the ros topics that are available to you in the ROS ecosystem.