-
Notifications
You must be signed in to change notification settings - Fork 566
feat: New parameter and cli arguments handling #1060
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: ros2
Are you sure you want to change the base?
Conversation
Don't retrieve ROS parameters in rosbridge_library, instead, use parameters dictionary passed to RosbridgeProtocol for everything
Instead of passing them using a class variable
Respect max_message_size parameter when determining fragment size, even when client provides fragment_size parameter
I won't get to review this for a bit, but have you considered possibly using https://github.com/PickNikRobotics/generate_parameter_library? Not sure how well this will do with hybrid ROS params and CLI arguments though, but at least may package up your params in a neat struct. |
Might be a good idea. I'll try to figure out whether I can use it together with cli args |
@sea-bass I looked at the possibility of using generate_parameter_library and IMO it's not worth it. It will only add complexity instead of simplifying it and won't provide any useful features. All of the parameters are read-only (read only once at the start) and don't require any validation. Also it's not possible to retrieve parameter descriptions for cli args before declaring ROS parameters. |
Let's be honest here. The way parameters are passed down from rosbridge_server to the Rosbridge protocol and internal classes is a complete mess:
Protocol.parameters
dictionary.This PR contains the following modifications:
Protocol
class now allows passing the parameters through the constructor instead of class variableprotocol.parameters
upon initialization (No need to settopics_glob
class variables) and use instance variables to get them later (e.g.self.topics_glob
instead ofAdvertise.topics_glob
).protocol.parameters
dictionary contains the keys.argparse
for parsing cli arguments (less boilerplate code and more user-friendly interface)protocol_parameters
is set inRosbridgeWebSocket
handler, no need to create it on every opened connectionactions_glob
parameterSome changes in behavior:
max_message_size
actually has effect now, that is, even when client sets thefragment_size
, the actual fragment size is capped tomax_message_size
value.What's left to do:
binary_encoder
andbson_only_mode
.Even though this is still WIP, I would appreciate a review