How to log float64 on arduino?
I'm having trouble logging a float64 value. Here's my arduino code (I'm using rosserial):
void jt_callback(const trajectory_msgs::JointTrajectory &msg) {
// http://docs.ros.org/kinetic/api/trajectory_msgs/html/msg/JointTrajectoryPoint.html
trajectory_msgs::JointTrajectoryPoint *points = msg.points; <-- is this correct?
sprintf(log_msg,"points[0].positions[0] = %f",points[0].positions[0]); <-- correct?
nh.loginfo(log_msg);
}
Output:
[INFO] [1487350593.639400, 5453.955000]: points[0].positions[0] = ?
The correct value should be 0.1
not ?
.
Also, when I try %d
or %i
the output value is -13108
.
Any help is much appreciated!