-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
87 lines (69 loc) · 2.46 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Define the image names
IMAGE_NAME_RECEIVE=ros-noetic-receive
IMAGE_NAME_PUBLISH=ros-noetic-publish
IMAGE_NAME_MASTER=ros-noetic-master
# Define the container names
CONTAINER_NAME_RECEIVE=ros-receive-container
CONTAINER_NAME_PUBLISH=ros-publish-container
CONTAINER_NAME_MASTER=ros-master-container
ROS_MASTER_URI=http://192.168.1.41:11311
ROS_IP=192.168.1.45
LAUNCH_VOLUME=/home/ubuntu/catkin_ws/
SCRIPTS_VOLUME=./scripts_volume
# Build the Docker image for the ROS master node using Dockerfile.roscore
build-master:
docker build -f Dockerfile.roscore -t $(IMAGE_NAME_MASTER) .
# Build the Docker image for receiving data using Dockerfile.receive
build-receive:
docker build -f Dockerfile.receive -t $(IMAGE_NAME_RECEIVE) .
run-master: create-network
docker run -d --rm --network $(NETWORK_NAME) \
--name $(CONTAINER_NAME_MASTER) \
$(IMAGE_NAME_MASTER)
# Build the Docker image for publishing data using Dockerfile.publish
build-publish:
docker build -f Dockerfile.publish -t $(IMAGE_NAME_PUBLISH) .
# Run the Docker container for publishing data and act as ROS master
# This currently does not work, but the command is useful
run-publish:
docker run -it --rm --network host \
--name $(CONTAINER_NAME_PUBLISH) \
-e ROS_MASTER_URI=$(ROS_MASTER_URI) \
-e ROS_IP=$(ROS_IP) \
-v $(LAUNCH_VOLUME):/home/ubuntu/catkin_ws \
-v $(SCRIPTS_VOLUME):/home/ubuntu/scripts \
--privileged \
$(IMAGE_NAME_PUBLISH)
publish-interactive:
docker run -it --rm --network host \
--name $(CONTAINER_NAME_PUBLISH) \
-e ROS_MASTER_URI=$(ROS_MASTER_URI) \
-e ROS_IP=$(ROS_IP) \
-v $(LAUNCH_VOLUME):/home/ubuntu/catkin_ws \
-v $(SCRIPTS_VOLUME):/home/ubuntu/scripts \
-v /dev:/dev \
--privileged \
$(IMAGE_NAME_PUBLISH) /bin/bash
# Run the Docker container for receiving data
run-receive: create-network
docker run -it --rm --network $(NETWORK_NAME) \
--name $(CONTAINER_NAME_RECEIVE) \
-e ROS_MASTER_URI=http://$(CONTAINER_NAME_MASTER):11311 \
$(IMAGE_NAME_RECEIVE)
# Stop and remove the master container
clean-master:
docker stop $(CONTAINER_NAME_MASTER)
docker rm $(CONTAINER_NAME_MASTER)
# Stop and remove the receive container
clean-receive:
docker stop $(CONTAINER_NAME_RECEIVE)
docker rm $(CONTAINER_NAME_RECEIVE)
# Stop and remove the publish container
clean-publish:
docker stop $(CONTAINER_NAME_PUBLISH)
docker rm $(CONTAINER_NAME_PUBLISH)
# Remove the Docker images
clean-images:
docker rmi $(IMAGE_NAME_RECEIVE)
docker rmi $(IMAGE_NAME_PUBLISH)
docker rmi $(IMAGE_NAME_MASTER)