Ros 2 command line service call with array of custom msg
Hi,
I'm using ROS 2 Bouncy on Ubuntu 18 and I'm trying to call a service from command line.
I can't seem to formulate a good srv while using the command line and get an error :
Failed to populate field 'array': The 'array' field must be a set or sequence and each value of type 'LiftId'
The command I'm using is :
ros2 service call /get_lift_info_array kone_open_opc_interfaces/GetLiftInfoArray "
{
array: [
{
gateway_ip: 'a',
gateway_port: 1,
opc_serv_ip: 'b',
opc_serv_type: 'v',
site: 'd',
location: 'e',
group: 'f',
lift: 'g'
}
]
}"
So I have a srv file called GetLiftInfoArray.srv:
LiftId[] array
---
And LiftId.msg is defined as bellow:
string gateway_ip
int32 gateway_port
string opc_serv_ip
string opc_serv_type
string site
string location
string group
string lift
To note that I can make it works when the array is empty :
ros2 service call /get_lift_info_array kone_open_opc_interfaces/GetLiftInfoArray "
{
array: [
]
}"
And I can also make it works when I use a python file with a client calling the service :
...
cli = node.create_client(GetLiftInfoArray, 'get_lift_info_array')
req = GetLiftInfoArray.Request()
req.array = []
lift_id = LiftId()
lift_id.gateway_ip = 'a'
lift_id.gateway_port = 1
lift_id.opc_serv_ip = 'b'
lift_id.opc_serv_type = 'c'
lift_id.site = 'd'
lift_id.location = 'e'
lift_id.group = 'f'
lift_id.lift = 'g'
req.array.append(lift_id)
...
It works, but I would like to be able to use the command line, does anyone have any idea of what's wrong with my command ?
Thank you.