async Service handler fails due to bad result type

This issue has been tracked since 2022-05-19.

Description
i

  • Library Version: 1.3.0
  • ROS Version:
  • Platform / OS: Ubuntu

Steps To Reproduce
const service = new ROSLIB.Service({
ros,
name: '/foo/testing',
serviceType: 'std_srvs/SetBool'
});

service.advertise(async (req, resp) => {
console.log('req:', req);
resp.success = req.data;
resp.message = passed ${req.data};
return true;
});

Expected Behavior
rosservice call /foo/testing "data: false"
should output
success: False
message: "passed false"

Actual Behavior
rosservice call hangs
rosbridge reports:
service_response: Expected
\ field result to be one of (<class 'bool'>,). Invalid value: {}"
file: "protocol.py"

in Service.js, changing _service response to start like this seems to resolve the issue in my small use case:
Service.prototype._serviceResponse = async function(rosbridgeRequest) {
var response = {};
var success = await this._serviceCallback(rosbridgeRequest.args, response);

More Details About Repo
Owner Name RobotWebTools
Repo Name roslibjs
Full Name RobotWebTools/roslibjs
Language JavaScript
Created Date 2013-03-15
Updated Date 2022-11-22
Star Count 549
Watcher Count 54
Fork Count 340
Issue Count 66

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date