Skip to content

Instantly share code, notes, and snippets.

@ma-he-sh
Created November 17, 2022 06:06
Show Gist options
  • Save ma-he-sh/34c08b1035991d7868f4c413b9190543 to your computer and use it in GitHub Desktop.
Save ma-he-sh/34c08b1035991d7868f4c413b9190543 to your computer and use it in GitHub Desktop.
Setting Up Realsense for ROS Noetic on M1 Mac using UTM

Setting Up UTM

Download Ubuntu 20.04 LTS (Focal Fossa) 64-bit arm

https://cdimage.ubuntu.com/releases/20.04.3/release/

https://cdimage.ubuntu.com/releases/20.04.3/release/ubuntu-20.04.5-live-server-arm64.iso

Setting up UTM

  1. Use Virtualize option
  2. For Operating System, Select Linux
  3. For Boot ISO, browse and select the Ubuntu 20.04 iso
  4. Under Hardware, set RAM to about 8024GB and set Enable Hardware OpenGL acceleration (optional)
  5. Set Storage to 30GB
  6. Optionaly set the Shared Directory
  7. Under summary set Open VM Settings and Save
  8. On the popup settings, under VirtIO Drive, set Interface to NVMe and Save
  9. Run the VM
  10. Install Ubuntu server by following each section, after reboot, stop the VM
  11. Goto VM Settings by clicking the 'Edit Selected VM', Under Devices, delete the USB Drive (which mounted the ISO)
  12. Makesure ubuntu shell is showing up

Setting up Ubuntu

# install display manager
$ sudo apt install slim

# you can install ubuntu-desktop by 
$ sudo apt install ubuntu-desktop

# or install much lighter desktop xfce by
$ sudo apt-get install xfce4-session xfce4-goodies

$ sudo reboot

Install ROS Noetic

https://wiki.ros.org/noetic/Installation/Ubuntu

$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

$ sudo apt upgrade && sudo apt update

$ sudo apt install curl

$ curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -

$ sudo apt update

# Install full ros by
$ sudo apt install ros-noetic-desktop-full

# or just the basic core base by
$ sudo apt install ros-noetic-ros-base

Install realsense SDK

https://dev.intelrealsense.com/docs/compiling-librealsense-for-linux-ubuntu-guide Download source files for librealsense from here; https://github.com/IntelRealSense/librealsense/releases Example,

$ wget https://github.com/IntelRealSense/librealsense/archive/refs/tags/v2.52.1.zip
$ unzip v2.52.1.zip
$ cd librealsense-2.52.1
$ mkdir build
$ cd build
$ cmake ../ -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=false

# recompile and install librealsense 
$ sudo make uninstall && make clean && make && sudo make install

Setup catkin workspace

$ source /opt/ros/noetic/setup.bash
$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/
$ catkin_make

$ source devel/setup.sh

Add realsense ros package

https://github.com/IntelRealSense/realsense-ros/releases

$ cd ~/catkin_ws/src

# find and download the version for your ros environment, search Noetic to find the source files
$ wget https://github.com/IntelRealSense/realsense-ros/archive/refs/tags/2.3.2.zip

unzip 2.3.2.zip
$ mv realsense-ros-2.3.2 realsense-ros

$ cd ~/catkin_ws/
$ sudo apt-get install python3-rosdep -y
$ sudo rosdep init
$ rosdep update

$ catkin_make

# if missing dependency with ddynamic_reconfigure error occured; do following
$ sudo apt-get update apt-get install ros-kinetic-ddynamic-reconfigure
$ catkin_make

Enable USB passthrough on UTM

  1. Goto Inputs section of the VM setting popup by clicking 'Edit Selected VM'
  2. Select Share USB devices from host
  3. Now connect the realsense camera to Mac and UTM will recognize and passthrough the USB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment