ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
You're very close. As there is currently no helper in rclpy, the "easier" might be to use only rcl_interfaces
type for now to avoid confusion
The 'parameters' field must be a set or sequence and each value of type 'Parameter'
This means that you need to pass a rcl_interfaces.msg.Parameter
to this function.
Then I kept trying, used ParameterValue, like this:
That's the way to go. On top of defining the value, the type of the parameter needs to be set, as it is not detected automatically
Parameter(name='parameter_1', value=ParameterValue(integer_value=3, type=ParameterType.PARAMETER_INTEGER))
The send_request
function will look like this:
def send_request(self):
new_param_value = ParameterValue(type=ParameterType.PARAMETER_INTEGER, integer_value=13)
self.req.parameters = [Parameter(name='parameter_1', value=new_param_value)]
self.future = self.cli.call_async(self.req)
Note that you'll need to import ParameterType
from rcl_interfaces.msg at the top of your file.