Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
desktop_robotti
drobotti-processing-and-control
Commits
07b88e19
Commit
07b88e19
authored
Nov 18, 2021
by
levi
Browse files
added rmq subscriber to launch with compose
parent
acc9927f
Changes
8
Hide whitespace changes
Inline
Side-by-side
docker/readme.md
View file @
07b88e19
...
...
@@ -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
...
...
docker/rmq-
publisher
/docker-compose.yml
→
docker/rmq-
bridge
/docker-compose.yml
View file @
07b88e19
...
...
@@ -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:
...
...
docker/rmq-
publisher/rmq_publisher
.Dockerfile
→
docker/rmq-
bridge/rmq_bridge
.Dockerfile
View file @
07b88e19
...
...
@@ -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
docker/terminal.yml
View file @
07b88e19
...
...
@@ -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
...
...
src/rmq_bridge/config/default.yml
View file @
07b88e19
...
...
@@ -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
src/rmq_bridge/launch/rmq_
publisher
.launch.py
→
src/rmq_bridge/launch/rmq_
bridge
.launch.py
View file @
07b88e19
File moved
src/rmq_bridge/launch/rmq_
publisher
_docker.launch.py
→
src/rmq_bridge/launch/rmq_
bridge
_docker.launch.py
View file @
07b88e19
...
...
@@ -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'
),
])
src/rmq_bridge/rmq_bridge/rmq_subscriber.py
View file @
07b88e19
...
...
@@ -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
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment