Skip to content
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.

foxglove websocket: Remember parameter types #6613

Conversation

achim-k
Copy link
Contributor

@achim-k achim-k commented Aug 8, 2023

User-Facing Changes
Not worth being mentioned in release notes

Description
When setting a float parameter to e.g. 1.0, Javascript automatically makes it to 1 and the server would deduce this as a integer parameter. Remembering the parameter type that is communicated by the server, and sending it along with a setParameter request fixes this.

See also foxglove/ws-protocol#519 and foxglove/ros-foxglove-bridge#256

Fixes #6559

Copy link
Contributor

@snosenzo snosenzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine this is related to the float64 and float64_array type additions, but from the description and the code it's hard to see how just passing the type with the parameter allows the receiver to properly cast 1 to 1.0. Where does this conversion happen? Is something already looking for float64 to cast it?

@achim-k
Copy link
Contributor Author

achim-k commented Aug 9, 2023

Where does this conversion happen? Is something already looking for float64 to cast it?

This is done on the server side. The server casts integers to doubles if the type is float64 (or float64_array). See also foxglove/ros-foxglove-bridge#256

Copy link
Contributor

@snosenzo snosenzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying. I think I see now

@achim-k achim-k requested a review from jtbandes August 16, 2023 14:28
@achim-k achim-k merged commit ca4ab3d into main Aug 16, 2023
15 checks passed
@achim-k achim-k deleted the achim/fg-4486-setting-parameter-of-type-double-to-10-throws-type-error branch August 16, 2023 16:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Setting Parameter of Type Double to Integer w/Trailing 0 Throws Type Error
3 participants