Skip to content
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

Service containing bounded array message #899

Open
lester-turing opened this issue Dec 26, 2023 · 0 comments
Open

Service containing bounded array message #899

lester-turing opened this issue Dec 26, 2023 · 0 comments
Labels

Comments

@lester-turing
Copy link

I use roslibjs to call ros2 services through rosbridge_server on the target software, most of the functions being fine but only the one, containing bounded array, works unexpectedly. I have researched for issue list on roslibjs and rosbridge_suite
github but there is no topic discussed about this. If anyone can give me a feedback, it will be very helpful, thanks.

  • Library Version: ros2
  • ROS Version: humble
  • Platform / OS: Ubuntu 22.04.3 LTS (wsl)

Steps To Reproduce

the javascript part

initializeLocalization = () => {
        const { ros } = this.state;
        const datas = {
            pose: [
                {
                    header: {
                        stamp: {
                            nanosec: 0,
                            sec: 0,
                        },
                        frame_id: "map",
                    },
                    pose: {
                        pose: {
                            position: {
                                y: 73768.390625,
                                x: 3754.39208984375,
                                z: 0.0,
                            },
                            orientation: {
                                y: 0.0,
                                x: 0.0,
                                z: -0.5479397800561485,
                                w: 0.8365177807028489,
                            },
                        },
                        covariance: [
                            0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.25, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                            0.0, 0.06853891909122467,
                        ],
                    },
                },
            ],
        };
        const request = new ROSLIB.ServiceRequest(datas);

        const service = new ROSLIB.Service({
            ros: ros,
            name: "/api/localization/initialize",
            serviceType: "autoware_adapi_v1_msgs/srv/InitializeLocalization",
        });

        service.callService(request, (result) => {
            console.log("initialize Result: " + result);
        });
    };

The type definition is as blew

geometry_msgs/PoseWithCovarianceStamped[<=1] pose
---
uint16 ERROR_UNSAFE = 1
uint16 ERROR_GNSS_SUPPORT = 2
uint16 ERROR_GNSS = 3
uint16 ERROR_ESTIMATION = 4
autoware_adapi_v1_msgs/ResponseStatus status

ad-api/list/api/localization/initialize/
ad-api/types/autoware_adapi_v1_msgs/srv/InitializeLocalization/

Expected Behavior
Success to call the ros2 service and get the response.

Actual Behavior
Got the wrong type included because the wrong type parsing, I guess. The right type is PoseWithCovarianceStamped, but server uses "PoseWithCovarianceStamped, 1" while running the code.

[rosbridge_websocket-1] [ERROR] [1703146503.535621124] [rosbridge_websocket]: [Client 41bcd064-4da8-40ca-8cf5-dde4dfe46cf8] [id: call_service:/api/localization/initialize:67] call_service InvalidClassException: Unable to import msg class PoseWithCovarianceStamped, 1 from package geometry_msgs. Caused by module 'geometry_msgs.msg' has no attribute 'PoseWithCovarianceStamped, 1'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant