Comments (6)
It looks like the issue comes from the way the flight controller casts the parameter value. The line in question is s->val.i = *(int32_t *)val;
The equivalent line for a float param is s->val.f = *(float *)val;
which works correctly. It seems like even though the param set message always sends a float value, the binary data contained in that float value is directly cast as whatever datatype the PARAM_TYPE_XXX says, in this case an int32.
A potential solution is:
- gomavlib casts the data to an int32 (or other MAV_PARAM_TYPE) binary representation
- casts that binary representation to a float*
- sets the float value in the param set message to that binary representation
Does this seem like a reasonable approach? I'm not sure if this is an issue on other flight controllers or if it's only an issue for PX4.
from gomavlib.
I think I found a solution/workaround. It might be worthwhile to implement this in the gomavlib library so a user doesn't need to worry about casting datatypes. I used a standard type cast to convert the floating point value to an int, converted the int to its binary form with the encoding/binary
package, and then wrote the resulting binary representation back to the address of my floating point parameter value. Things seem to work now.
from gomavlib.
Seems like this is the way the message is intended to work. The solution I proposed has been tested on hardware and seems to be reliable.
from gomavlib.
Hello, dialects are automatically generated from definitions, therefore this issue is common to all programming languages. At the moment there aren't much utilities in the library since it's already hard to support all upstream changes that come from the main Mavlink repository, so adding more stuff is out of the reach.
from gomavlib.
from gomavlib.
This issue is being locked automatically because it has been closed for more than 6 months.
Please open a new issue in case you encounter a similar problem.
from gomavlib.
Related Issues (20)
- Cannot use version v3.0.0 HOT 1
- OutSystemID should also be allowed as 0 HOT 2
- Use of custom dialect makes node.Close() hang HOT 1
- Read a file and generate mavlink events like a simulation HOT 4
- How to add a customize message HOT 4
- crash on github.com/aler9/gomavlib/pkg/frame.(*V2Frame).Decode HOT 3
- Trouble with MessageParamExtRequestList HOT 4
- Constant overflows for enum when building for armv7 HOT 3
- java link is broken HOT 2
- about gomavlib and mavsdk-go HOT 2
- send MAV_CMD HOT 1
- MOUNT_STATUS is not parsed correctly HOT 2
- Relaying a message with a different sourceSystemID HOT 2
- bug in enum MarshalText() methods HOT 2
- dialect-import error raised 'ERR: unable to open: open custommessages.xml: no such file or directory' HOT 4
- Field index out of range while writing messages HOT 17
- Enums are incorrectly treated as bit masks when converted to strings HOT 1
- Bitmask enums conversion from string HOT 2
- MAVLink XML change to allow exponentiation operator in bitmask flag HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gomavlib.