Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/humble' into backport-953-humble
Browse files Browse the repository at this point in the history
  • Loading branch information
sea-bass committed Oct 7, 2024
2 parents ce0c312 + 3ad9778 commit 3728792
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 23 deletions.
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See https://pre-commit.com for more information
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -16,27 +16,27 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 22.3.0
rev: 24.8.0
hooks:
- id: black

- repo: https://github.com/PyCQA/flake8
rev: 3.9.2
rev: 7.1.1
hooks:
- id: flake8

- repo: https://github.com/PyCQA/bandit
rev: 1.7.0
rev: 1.7.10
hooks:
- id: bandit
args: ["--skip", "B101,B110,B311"]

- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
rev: v2.3.0
hooks:
- id: codespell
12 changes: 6 additions & 6 deletions ROSBRIDGE_PROTOCOL.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ ROS operations:
* **call_service** - a service call
* **service_response** - a service response
* Actions:
* **advertise_action** - advertise an external action server
* **unadvertise_action** - unadvertise an external action server
* **send_action_goal** - a goal sent to an action server
* **cancel_action_goal** - cancel an in-progress action goal
* **action_feedback** - feedback messages from an action server
* **action_result** - an action result
* **advertise_action** - advertise an external action server
* **unadvertise_action** - unadvertise an external action server
* **send_action_goal** - a goal sent to an action server
* **cancel_action_goal** - cancel an in-progress action goal
* **action_feedback** - feedback messages from an action server
* **action_result** - an action result

In general, actions or operations that the client takes (such as publishing and
subscribing) have opcodes which are verbs (subscribe, call_service, unadvertise
Expand Down
4 changes: 3 additions & 1 deletion rosapi/src/rosapi/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ def init(parent_node_name):
parent_node_basename = parent_node_name.split("/")[-1]
param_node_name = f"{parent_node_basename}_params"
_node = rclpy.create_node(
param_node_name, cli_args=["--ros-args", "-r", f"__node:={param_node_name}"]
param_node_name,
cli_args=["--ros-args", "-r", f"__node:={param_node_name}"],
start_parameter_services=False,
)
_parent_node_name = get_absolute_node_name(parent_node_name)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ async def execute_callback(self, goal: Any) -> Any:
# generate a unique ID
goal_id = f"action_goal:{self.action_name}:{self.next_id()}"

def done_callback(fut: rclpy.task.Future()) -> None:
def done_callback(fut: rclpy.task.Future) -> None:
if fut.cancelled():
goal.abort()
self.protocol.log("info", f"Aborted goal {goal_id}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def next_id(self):

async def handle_request(self, req, res):
# generate a unique ID
request_id = f"service_request:{self.service_name }:{self.next_id()}"
request_id = f"service_request:{self.service_name}:{self.next_id()}"

future = rclpy.task.Future()
self.request_futures[request_id] = future
Expand Down
2 changes: 1 addition & 1 deletion rosbridge_library/src/rosbridge_library/capability.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def basic_type_check(self, msg, types_info):
"""Performs basic typechecking on fields in msg.
Keyword arguments:
msg -- a message, deserialized into a dictoinary
msg -- a message, deserialized into a dictionary
types_info -- a list of tuples (mandatory, fieldname, fieldtype) where
mandatory - boolean, is the field mandatory
fieldname - the name of the field in the message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ def subscribe(self, client_id, callback):
# In any case, the first message is handled using new_sub_callback,
# which adds the new callback to the subscriptions dictionary.
self.new_subscriptions.update({client_id: callback})
infos = self.node_handle.get_publishers_info_by_topic(self.topic)
if any(pub.qos_profile.durability == DurabilityPolicy.TRANSIENT_LOCAL for pub in infos):
self.qos.durability = DurabilityPolicy.TRANSIENT_LOCAL
if any(pub.qos_profile.reliability == ReliabilityPolicy.BEST_EFFORT for pub in infos):
self.qos.reliability = ReliabilityPolicy.BEST_EFFORT
if self.new_subscriber is None:
self.new_subscriber = self.node_handle.create_subscription(
self.msg_class,
Expand All @@ -196,7 +201,7 @@ def unsubscribe(self, client_id):
with self.rlock:
if client_id in self.new_subscriptions:
del self.new_subscriptions[client_id]
else:
if client_id in self.subscriptions:
del self.subscriptions[client_id]

def has_subscribers(self):
Expand Down
1 change: 0 additions & 1 deletion rosbridge_library/src/rosbridge_library/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ def serialize(self, msg, cid=None):
return None

def deserialize(self, msg, cid=None):

"""Turns the wire-level representation into a dictionary of values
Default behaviour assumes JSON. Override to use a different container.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def request_service():
"position": {"y": 0.0, "x": 0.0, "z": 0.0},
"orientation": {"y": 0.0, "x": 0.0, "z": 0.0, "w": 0.0},
}
}
},
# "count" : request_byte_count # count is the parameter for send_bytes as defined in srv-file (always put into args field!)
}
service_request = json.dumps(service_request_object)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def test_publish(self):
"""Make sure that publishing works"""
topic = "/test_publish"
msg_type = "std_msgs/String"
msg = {"data": "why halo thar"}
msg = {"data": "why hello there"}

received = {"msg": None}

Expand All @@ -133,7 +133,7 @@ def test_publish_twice(self):
"""Make sure that publishing works"""
topic = "/test_publish_twice"
msg_type = "std_msgs/String"
msg = {"data": "why halo thar"}
msg = {"data": "why hello there"}

received = {"msg": None}

Expand Down
2 changes: 1 addition & 1 deletion rosbridge_server/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ Changelog for package rosbridge_server
* merging changes of groovy-devel into hydro-devel
* Specific IP address binding using roslauch
* added parameter lookup to rosbridge_tcp.py, modules where those are used, and default parameters to launch file; internal default-values still get used when launch-file does not provide them; internal defaults can be changed within rosbridge_tcp.py
* increaing max_msg_length - still hardcoded
* increasing max_msg_length - still hardcoded
* preparing pull request for upstream..
* cleanup: files, notes, some code
* cleanup tcp-server
Expand Down
8 changes: 7 additions & 1 deletion rosbridge_server/scripts/rosbridge_websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,13 @@ def main(args=None):

executor = rclpy.executors.SingleThreadedExecutor()
executor.add_node(node)
spin_callback = PeriodicCallback(lambda: executor.spin_once(timeout_sec=0.01), 1)

def spin_ros():
executor.spin_once(timeout_sec=0.01)
if not rclpy.ok():
shutdown_hook()

spin_callback = PeriodicCallback(spin_ros, 1)
spin_callback.start()
try:
start_hook()
Expand Down

0 comments on commit 3728792

Please sign in to comment.