ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

You need to replace the lines like:

joint_constraint.position = Float64(1.0)

with

joint_constraint.position = 1.0

By calling Float64(1.0) you are creating a ROS message instance of type Float64, when what you really need is a Python float datatype. On the msg ROS wiki page there is documentation describing how primitive field types correspond to client library types for C++ and Python. That documentation indicates a field type of float64 in a message definition should be a float in Python.

You need to replace the lines like:

joint_constraint.position = Float64(1.0)

with

joint_constraint.position = 1.0

By calling Float64(1.0) you are creating a ROS message instance of type Float64, when what you really need is a Python float datatype. On the msg ROS wiki page there is documentation describing how primitive field types correspond to client library types for C++ and Python. That documentation indicates a field type of float64 in a message definition should be a float in Python.

The Float64 message from std_msgs actually has a single field named data of type float64. That's where the data: 1.0 lines in your traceback are coming from. Also note, the key part of your error is this:

genpy.message.SerializationError: <class 'struct.error'>: 'required argument is not a float'...