ros / ros_comm

ROS communications-related packages, including core client libraries (roscpp, rospy, roslisp) and graph introspection tools (rostopic, rosnode, rosservice, rosparam).
http://wiki.ros.org/ros_comm
747 stars 914 forks source link

Missing const qualifiers in member functions of the ServiceClient class. #2312

Open hogabrie opened 1 year ago

hogabrie commented 1 year ago

The following 3 member functions of ServiceClient are non-const: ServiceClient::getService(), ServiceClient::exists() and ServiceClient::waitForExistence(ros::Duration timeout).

They call free functions and do not alter the state of the class, they should thus be labeled const like isValid or isPersistent. If those methods are non-const, it's hard to write const-correct downstream code (unless you make the ServiceClient member mutable :disappointed: ).

peci1 commented 1 year ago

Your request seems valid to me. Could you send a pull request with the fix? Feel free to ping me from the PR for a review (although I'm not a core ROS reviewer).