Added real32 (Beckhoff float) and real64 (Beckhoff double)#132
Added real32 (Beckhoff float) and real64 (Beckhoff double)#132JensVanhooydonck wants to merge 4 commits intoICube-Robotics:mainfrom
Conversation
|
Still need to test this. As soon as next monday. |
|
Hi JensVanhooydonck, |
…d EC_WRITE_REAL aren't always available.
|
It seems that the EC_READ_REAL and EC_WRITE_REAL funtions aren't always available. Used the same logic (bit casting) and reading and writing with the EC_READ_UINT32 and EC_WRITE_UINT32 functions. For the sdo, there was currently only int value data available. I added a double data value as well. Should I keep it this way, or should I change the data type from int to double and cast the value to int for the existing sdo's? Also, should I also add the double/real64 values as well? |
|
Hi JensVanhooydonck,
That is the way it should be done to work everywhere.
I think having different types is the ideal way to go, especially if we imagine having 64 bits integers at some point.
2 cases:
|
I've tested this with real32 already and everything seems to work correctly. Don't have a device with Real64 items currently. If needed, i can comment this part out. |
christophfroehlich
left a comment
There was a problem hiding this comment.
I think that there are some copy-paste errors for double type?
| uint32_t raw = *(uint32_t *)&value; | ||
| EC_WRITE_U64(domain_address, static_cast<uint64_t>(raw)); |
There was a problem hiding this comment.
| uint32_t raw = *(uint32_t *)&value; | |
| EC_WRITE_U64(domain_address, static_cast<uint64_t>(raw)); | |
| uint64_t raw = *(uint64_t *)&value; | |
| EC_WRITE_U64(domain_address, static_cast<uint64_t>(raw)); |
| float floatvalue = sdo_config["value"].as<float>(); | ||
| data = *(int *)&floatvalue; | ||
| } else if (data_type == "double" || data_type == "real64") { | ||
| float doublevalue = sdo_config["value"].as<double>(); |
There was a problem hiding this comment.
| float doublevalue = sdo_config["value"].as<double>(); | |
| double doublevalue = sdo_config["value"].as<double>(); |
I need to set some values which have type REAL32.
https://infosys.beckhoff.com/english.php?content=../content/1033/ioanalogmanual/12855866763.html&id=