Skip to content

Commit

Permalink
ogma-core: Map float and double to the same types in C++. Refs #138.
Browse files Browse the repository at this point in the history
The ROS backend is, by default, assuming that the data carried by
std_msgs::msg::Float32 is of type float32, when it appears to be just a
float. The same is happening for Float64, float64 and double. The code
currently produced for those cases does not compile.

The type mappings are described in
http://docs.ros.org/en/humble/Concepts/Basic/About-Interfaces.html,
which states that, in C++, float and double should be used.

This commit modifies the ROS backend so that it expects global variables
of input types `float` and `double` in the variable DB to have the types
`float` and `double`, respectively, in the generated C++ code.
  • Loading branch information
ivanperez-keera committed May 21, 2024
1 parent 9709229 commit 87bd5e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ogma-core/src/Command/ROSApp.hs
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,8 @@ rosMonitorContents varNames variables msgIds msgNames msgDatas monitors =
"int16_t" -> "std::int16_t"
"int32_t" -> "std::int32_t"
"int64_t" -> "std::int64_t"
"float" -> "std::float32"
"double" -> "std::float64"
"float" -> "float"
"double" -> "double"
def -> def

msgSubscriptionS = unlines
Expand Down

0 comments on commit 87bd5e8

Please sign in to comment.