Skip to content

Commit

Permalink
Add new capabilities to rosbridge protocol.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sea-bass committed Oct 31, 2023
1 parent 57b1467 commit d78c3bf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ def execute_callback(self, goal):
del self.goal_handles[goal_id]
return result


def handle_feedback(self, goal_id, feedback):
"""
Called by the ActionFeedback capability to handle action feedback from the external client.
Expand All @@ -104,7 +103,6 @@ def handle_feedback(self, goal_id, feedback):
else:
self.protocol.log("warning", f"Received action feedback for unrecognized id: {goal_id}")


def handle_result(self, goal_id, res):
"""
Called by the ActionResult capability to handle an action result from the external client.
Expand Down
14 changes: 9 additions & 5 deletions rosbridge_library/src/rosbridge_library/rosbridge_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

from rosbridge_library.capabilities.action_feedback import ActionFeedback
from rosbridge_library.capabilities.action_result import ActionResult
from rosbridge_library.capabilities.advertise import Advertise

# imports for external service_server
from rosbridge_library.capabilities.advertise_action import AdvertiseAction
from rosbridge_library.capabilities.advertise_service import AdvertiseService
from rosbridge_library.capabilities.call_service import CallService

# imports for defragmentation
from rosbridge_library.capabilities.defragmentation import Defragment
from rosbridge_library.capabilities.publish import Publish
from rosbridge_library.capabilities.send_action_goal import SendActionGoal
from rosbridge_library.capabilities.service_response import ServiceResponse
from rosbridge_library.capabilities.subscribe import Subscribe
from rosbridge_library.capabilities.unadvertise_service import UnadvertiseService
Expand All @@ -49,14 +49,18 @@ class RosbridgeProtocol(Protocol):
"""Adds the handlers for the rosbridge opcodes"""

rosbridge_capabilities = [
CallService,
Advertise,
Publish,
Subscribe,
Defragment,
AdvertiseService,
CallService,
ServiceResponse,
UnadvertiseService,
AdvertiseAction,
ActionFeedback,
ActionResult,
SendActionGoal,
]

print("registered capabilities (classes):")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
from json import dumps, loads
from threading import Thread

from example_interfaces.action._fibonacci import Fibonacci_FeedbackMessage

import rclpy
from example_interfaces.action._fibonacci import Fibonacci_FeedbackMessage
from rclpy.executors import MultiThreadedExecutor
from rclpy.node import Node
from rclpy.qos import DurabilityPolicy, ReliabilityPolicy, QoSProfile
from rclpy.qos import DurabilityPolicy, QoSProfile, ReliabilityPolicy
from rosbridge_library.capabilities.action_feedback import ActionFeedback
from rosbridge_library.capabilities.action_result import ActionResult
from rosbridge_library.capabilities.advertise_action import AdvertiseAction
Expand Down Expand Up @@ -148,7 +147,8 @@ def test_execute_advertised_action(self):
Fibonacci_FeedbackMessage,
f"{action_path}/_action/feedback",
self.feedback_subscriber_cb,
sub_qos_profile)
sub_qos_profile,
)
time.sleep(0.1)

feedback_msg = loads(
Expand Down

0 comments on commit d78c3bf

Please sign in to comment.