Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mqtt_bridge
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile_robotics
GAUSS_project
mqtt_bridge
Commits
275cd0b1
Commit
275cd0b1
authored
7 years ago
by
Shin
Browse files
Options
Downloads
Patches
Plain Diff
fix if frequency is none
parent
7eb2d2bd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mqtt_bridge/bridge.py
+3
-2
3 additions, 2 deletions
src/mqtt_bridge/bridge.py
with
3 additions
and
2 deletions
src/mqtt_bridge/bridge.py
+
3
−
2
View file @
275cd0b1
...
@@ -94,7 +94,7 @@ class MqttToRosBridge(Bridge):
...
@@ -94,7 +94,7 @@ class MqttToRosBridge(Bridge):
self
.
_msg_type
=
msg_type
self
.
_msg_type
=
msg_type
self
.
_queue_size
=
queue_size
self
.
_queue_size
=
queue_size
self
.
_last_published
=
rospy
.
get_time
()
self
.
_last_published
=
rospy
.
get_time
()
self
.
_interval
=
0
if
frequency
is
None
else
1.0
/
frequency
self
.
_interval
=
None
if
frequency
is
None
else
1.0
/
frequency
self
.
_mqtt_client
.
subscribe
(
topic_from
)
self
.
_mqtt_client
.
subscribe
(
topic_from
)
self
.
_mqtt_client
.
message_callback_add
(
topic_from
,
self
.
_callback_mqtt
)
self
.
_mqtt_client
.
message_callback_add
(
topic_from
,
self
.
_callback_mqtt
)
...
@@ -110,7 +110,8 @@ class MqttToRosBridge(Bridge):
...
@@ -110,7 +110,8 @@ class MqttToRosBridge(Bridge):
"""
"""
rospy
.
logdebug
(
"
MQTT received from {}
"
.
format
(
mqtt_msg
.
topic
))
rospy
.
logdebug
(
"
MQTT received from {}
"
.
format
(
mqtt_msg
.
topic
))
now
=
rospy
.
get_time
()
now
=
rospy
.
get_time
()
if
now
-
self
.
_last_published
>=
self
.
_interval
:
if
self
.
_interval
is
None
or
now
-
self
.
_last_published
>=
self
.
_interval
:
ros_msg
=
self
.
_create_ros_message
(
mqtt_msg
)
ros_msg
=
self
.
_create_ros_message
(
mqtt_msg
)
self
.
_publisher
.
publish
(
ros_msg
)
self
.
_publisher
.
publish
(
ros_msg
)
self
.
_last_published
=
now
self
.
_last_published
=
now
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment