Commit 07b88e19 authored by levi's avatar levi
Browse files

added rmq subscriber to launch with compose

parent acc9927f
......@@ -15,7 +15,7 @@ Make sure docker is installed and the user has access to docker service.
#### Run:
```bash
docker-compose -f terminal.yml -d up
docker-compose -f terminal.yml up -d
```
To controlled the robotti attach to the teleop terminal by:
```bash
......
......@@ -13,11 +13,11 @@ services:
# - 15672:15672
# - 1883:1883
rmq-publisher:
container_name: drobotti-rmq-publisher
rmq-bridge:
container_name: drobotti-rmq-bridge
build:
context: ./../../
dockerfile: ./docker/rmq-publisher/rmq_publisher.Dockerfile
dockerfile: ./docker/rmq-bridge/rmq_bridge.Dockerfile
restart: unless-stopped
network_mode: "host"
# ports:
......
......@@ -47,4 +47,4 @@ RUN sed --in-place --expression \
/ros_entrypoint.sh
# run launch file
CMD ["ros2", "launch", "rmq_bridge", "rmq_publisher_docker.launch.py"]
\ No newline at end of file
CMD ["ros2", "launch", "rmq_bridge", "rmq_bridge_docker.launch.py"]
\ No newline at end of file
......@@ -35,11 +35,11 @@ services:
- drobotti
stdin_open: true # docker run -i
tty: true # docker run -t
rmq_publisher:
container_name: rmq-pub
rmq_bridge:
container_name: rmq-bridge
build:
context: ../
dockerfile: ./docker/rmq-publisher/rmq_publisher.Dockerfile
dockerfile: ./docker/rmq-bridge/rmq_bridge.Dockerfile
depends_on:
- rmq_server
- teleop_terminal
......
......@@ -2,6 +2,14 @@ rmq_publisher:
ros__parameters:
server_hostname: "localhost"
rmq_subscriber:
ros__parameters:
server_hostname: "localhost"
rmq_publisher_docker:
ros__parameters:
server_hostname: "rmq-srv" #containername
rmq_subscriber_docker:
ros__parameters:
server_hostname: "rmq-srv" #containername
\ No newline at end of file
......@@ -12,5 +12,13 @@ def generate_launch_description():
executable='rmq_publisher',
name='rmq_publisher_docker', # name in ros network
output='screen'
)
),
launch_ros.actions.Node(
parameters=[get_package_share_directory(
"rmq_bridge") + '/config/default.yml'],
package='rmq_bridge',
executable='rmq_subscriber',
name='rmq_subscriber_docker', # name in ros network
output='screen'
),
])
......@@ -21,6 +21,8 @@ class RabbitMQSubscriber(Node):
def __init__(self):
super().__init__("rabbitmq_subscriber")
self.declare_parameter('server_hostname','localhost')
self.init_rabbitmq()
self.forward_this = {
......@@ -79,7 +81,7 @@ class RabbitMQSubscriber(Node):
print("Initializing Connection")
try:
self.rmq_connection = pika.BlockingConnection(
pika.ConnectionParameters(host='localhost')
pika.ConnectionParameters(self.get_parameter('server_hostname').get_parameter_value().string_value)
)
self.rmq_channel = self.rmq_connection.channel()
self.rmq_channel.exchange_declare(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment