Skip to content

Commit

Permalink
added docker
Browse files Browse the repository at this point in the history
  • Loading branch information
mihyr committed Feb 28, 2022
1 parent 0bb3255 commit 3009a44
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 11 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ install(PROGRAMS
DESTINATION lib/${PROJECT_NAME}
)

# Install launch, rviz and config directories
# Install launch, rviz, meshes and config directories
install(DIRECTORY
launch config rviz
launch config rviz meshes
DESTINATION share/${PROJECT_NAME}
)

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

My implementation of the particle filter localization algorithm on turtlebot3 using ROS2 Galactic.

Please click on the gIF below to see the youtube video.
<p align="center">
<a href="https://youtu.be/lEZGuGSGVvE" target="_blank"><img src="https://media.giphy.com/media/nmNIrkJLIwdxobGSDc/giphy-downsized.gif" alt="Youtube Link" width=30%></a>
</p>
92 changes: 92 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
version: "3.9" # optional since v1.27.0
services:

webviz:
image: "cruise/webviz:latest"
container_name: netbots-webviz
ports:
- "8080:8080"
networks:
netbots:
ipv4_address: "172.18.0.2"
ros:
build:
context: .
dockerfile: ./netbots-ros/Dockerfile
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun:/dev/net/tun
container_name: netbots-ros
ports:
- "11411:11311"
- "9090:9090"
image: "net-bots:latest"

volumes:
- ovpn-data:/vpn_ws/
depends_on:
- openvpn-udp
links:
- "openvpn-udp"
networks:
netbots:
ipv4_address: "172.18.0.3"
command: roscore

openvpn-udp:
cap_add:
- NET_ADMIN
image: kylemanna/openvpn
container_name: netbots-vpn
ports:
- "1194:1194/udp"
restart: always
volumes:
- ovpn-data:/etc/openvpn

# openvpn-tcp:
# cap_add:
# - NET_ADMIN
# image: kylemanna/openvpn
# container_name: openvpn-tcp
# ports:
# - "1194:1194/tcp"
# restart: always
# volumes:
# - ./openvpn-data:/etc/openvpn
# command: 'ovpn_run --proto tcp'

networks:
netbots:
ipv4_address: "172.18.0.4"

nginx:
build:
context: .
dockerfile: ./netbots-nginx/Dockerfile
container_name: netbots-nginx
ports:
- "80:80"
- "443:443"
depends_on:
- webviz
links:
- "webviz"
networks:
netbots:
ipv4_address: "172.18.0.5"

networks:
netbots:
name: netbots-network
ipam:
driver: default
config:
- subnet: 172.18.0.0/16

volumes:
ovpn-data:
external: true
name: ovpn-data

2 changes: 1 addition & 1 deletion launch/offboard.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def generate_launch_description():
)

return LaunchDescription([
# rviz,
rviz,
landmark_detector,
visualizer,
core_filter
Expand Down
Binary file added meshes/Traffic_cone.stl
Binary file not shown.
5 changes: 3 additions & 2 deletions scripts/landmark_detector.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
from numpy.random.mtrand import f
import rclpy
from rclpy.node import Node
from std_msgs.msg import String
Expand Down Expand Up @@ -74,8 +75,8 @@ def scan_callback(self, msg):
xc, yc, R = circlefit(cluster)
# print(type(xc), type(yc), type(R))

if 0.065 < R < 0.08: #ideal 0.070744334 m

if 0.07 < R < 0.079: #ideal 0.070744334 m
self.get_logger().info(f'R: {R}')
# self.cone_marker_publisher(-xc,-yc,R,tag)
total_landmarks = total_landmarks + 1
tag = tag + 1
Expand Down
14 changes: 8 additions & 6 deletions scripts/visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ def cone_marker_publisher(self,xc,yc,R,tag):
self.marker.header.frame_id = "base_scan"
self.marker.header.stamp = self.get_clock().now().to_msg()
self.marker.id = tag
self.marker.type = Marker.CYLINDER
self.marker.type = Marker.MESH_RESOURCE
self.marker.mesh_resource = "package://particle_filter/meshes/Traffic_cone.stl"
self.marker.mesh_use_embedded_materials = False
self.marker.action = Marker.ADD
self.marker.scale = Vector3(x=0.15,y=0.15,z=0.4)
self.marker.scale = Vector3(x=0.018,y=0.018,z=0.018)
self.marker.color = ColorRGBA(r=random(1)[0],g=random(1)[0],b=random(1)[0],a=1.0)
self.marker.pose= Pose(position = Point(x=float(xc),y=float(yc),z=float(0)), orientation = Quaternion(x=float(0),y=float(0),z=float(0),w=float(1)))
self.marker.lifetime = Duration(sec = 2,nanosec=0)
self.marker.pose= Pose(position = Point(x=float(xc),y=float(yc),z=float(-0.175)), orientation = Quaternion(x=float(0),y=float(0),z=float(0),w=float(1)))
self.marker.lifetime = Duration(sec = 1,nanosec=0)
self.landmarks_marker_pub.publish(self.marker)
# print(f'cone marker published for tag {tag}')

Expand Down Expand Up @@ -93,8 +95,8 @@ def outlier_marker_publisher(self,outliers):
self.marker.type = Marker.SPHERE
self.marker.action = Marker.ADD
self.marker.scale = Vector3(x=0.02,y=0.02,z=0.02)
self.marker.color = ColorRGBA(r=random(1)[0],g=random(1)[0],b=random(1)[0],a=1.0)
self.marker.color = ColorRGBA(r=0.0,g=1.0,b=0.0,a=1.0)
# self.marker.color = ColorRGBA(r=random(1)[0],g=random(1)[0],b=random(1)[0],a=1.0)
self.marker.color = ColorRGBA(r=105.0,g=105.0,b=105.0,a=0.5)
# self.marker.pose= Pose(position = Point(x=float(0),y=float(0),z=float(0)), orientation = Quaternion(x=float(0),y=float(0),z=float(0),w=float(1)))
self.marker.pose.position = outliers[i]
self.marker.pose.position.z = 0.05
Expand Down

0 comments on commit 3009a44

Please sign in to comment.