Skip to content

Instantly share code, notes, and snippets.

@vfdev-5
Last active August 14, 2023 11:00
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save vfdev-5/b7685371071036cb739f23b3794b5b83 to your computer and use it in GitHub Desktop.
Save vfdev-5/b7685371071036cb739f23b3794b5b83 to your computer and use it in GitHub Desktop.
ROS development on MacOSX using docker

ROS development on MacOSX using docker

We need to use docker-machine to handle USB ports inside the docker.

Docker Machine (0.16.1)

Configuration

Follow this gist: https://gist.github.com/stonehippo/e33750f185806924f1254349ea1a4e68 to setup USB to be visible inside the container.

Pull ROS image

docker pull ros:latest

Run container

Following the guide : https://docs.docker.com/samples/library/ros/

Create network

docker network create ros-network

Container with roscore only

docker run -it --rm --net ros-network --name=roscore ros:latest roscore

Dev container

Command with debug support:

docker run -it --rm \
    --security-opt seccomp:unconfined \
    --net ros-network \
    -p 9091:9091 \
    --device=/dev/ttyUSB0 \
    -v $PWD:/home/project \
    --name=$container_name \
    --workdir=/home/project \
    $image_name /bin/bash

RViz container

Install XQuartz

Install it from : https://www.xquartz.org/

Configure following: https://sourabhbajaj.com/blog/2017/02/07/gui-applications-docker-mac/

Run XQuartz

IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
xhost +${IP}

Install RViz to ROS Image

Run

docker run --rm \
    --env="DISPLAY=192.168.5.43:0" \
    --volume="$HOME/.Xauthority:/root/.Xauthority:rw" \
    --net ros-network \
    --env ROS_MASTER_URI=http://roscore:11311 \    
    --name=rviz \
    ros_rviz:latest rviz
@PetWorm
Copy link

PetWorm commented Mar 13, 2020

hi, did you display rviz successfully by xquart?
I tried all the solutions i found and only manage to see the splash screen of rviz, and then segment fault.
would be appreciate if there is any suggestions from you

@yfcube
Copy link

yfcube commented Aug 10, 2020

hi, did you display rviz successfully by xquart?
I tried all the solutions i found and only manage to see the splash screen of rviz, and then segment fault.
would be appreciate if there is any suggestions from you

I encountered the same problem. rqt tool works fine but rviz keeps crashing.

@PetWorm
Copy link

PetWorm commented Aug 10, 2020

hi, did you display rviz successfully by xquart?
I tried all the solutions i found and only manage to see the splash screen of rviz, and then segment fault.
would be appreciate if there is any suggestions from you

I encountered the same problem. rqt tool works fine but rviz keeps crashing.

It seems there is a opengl problem. Check this out

@kklimuk
Copy link

kklimuk commented Nov 19, 2020

I figured out how to get ROS and RViz running on a Mac through docker.
Here's the repo and step by step instructions to get it running:
https://github.com/nebocleaning/mac-ros

@PetWorm
Copy link

PetWorm commented Nov 20, 2020

I figured out how to get ROS and RViz running on a Mac through docker.
Here's the repo and step by step instructions to get it running:
https://github.com/nebocleaning/mac-ros

good job bro, you can definitely get rviz running on mac through browser or vnc viewer, but what we talked about here is through the xquart

@naoki-17
Copy link

naoki-17 commented Sep 7, 2021

Hello, once I degrade to Xquartz 2.7.8, rviz was running successfully but now crash again,but other 3d viewers are runing well.

@jeff-hykin
Copy link

replace ros:latest with ros:noetic-ros-core to get core running.

However the rviz docker image is no longer available and I wasn't able to find an alternative that runs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment