How to use rosservice call with correct parameter form?
Hi,
I'm using Roscopter package and want to send some waypoints to my copter.
The /waypoint
is a service I can find using rosservice list
they type of /waypoint
is roscopter/SendWaypoint
I use rossrv show
to check the type format:
roscopter/Waypoint waypoint
uint8 TYPE_NAV=1
uint8 TYPE_CONDITION_YAW=2
uint8 TYPE_CONDITION_CHANGE_ALT=3
uint8 TYPE_TAKEOFF=4
int32 latitude
int32 longitude
int32 altitude
uint16 pos_acc
uint8 speed_to
uint16 hold_time
int32 yaw_from
int32 pan_angle
int32 tilt_angle
uint8 waypoint_type
---
bool result
then I run the command:
rosservice call /waypoint 15 22 0 40 0 30 3 0 0 0
I put 10 arguments for 10 parameters but got the error:
ERROR: Incompatible arguments to call service:
Too many arguments:
* Given: [15, 22, 0, 40, 0, 30, 3, 0, 0, 0]
* Expected: ['waypoint']
Provided arguments are:
* 15 (type int)
* 22 (type int)
* 0 (type int)
* 40 (type int)
* 0 (type int)
* 30 (type int)
* 3 (type int)
* 0 (type int)
* 0 (type int)
* 0 (type int)
Service arguments are: [waypoint.latitude waypoint.longitude waypoint.altitude waypoint.pos_acc waypoint.speed_to waypoint.hold_time waypoint.yaw_from waypoint.pan_angle waypoint.tilt_angle waypoint.waypoint_type]
the content of waypoint.msg
# latitude and longitude given in decimal degrees (* 10^7)
int32 latitude
int32 longitude
# height in mm
int32 altitude
# posAcc given in mm
uint16 pos_acc
# max speed to travel to waypoint in % of 100
uint8 speed_to
# time to stay at waypoint in ms
uint16 hold_time
# yawFrom angle given in degrees (* 1000)
int32 yaw_from
# camera pan and tilt angles during waypoint travel given in degrees (* 1000)
int32 pan_angle
int32 tilt_angle
# Type of Waypoint
uint8 waypoint_type
uint8 TYPE_NAV = 1
uint8 TYPE_CONDITION_YAW = 2
uint8 TYPE_CONDITION_CHANGE_ALT = 3
uint8 TYPE_TAKEOFF = 4
Then I used the following format but there is still an error:
>rosservice call /waypoint "{waypoint.latitude: 15, waypoint.longitude: 22, waypoint.speedTo: 0, waypoint.altitude: 40, waypoint.hold_time: 0, waypoint.yaw_from: 30, waypoint.pos_acc: 3, waypoint.pan_angle: 0,waypoint.tilt_angle: 0,waypoint_type: 1}"
ERROR: Incompatible arguments to call service:
No field name [waypoint.longitude]
Provided arguments are:
* {'waypoint.longitude': 22, 'waypoint.speedTo': 0, 'waypoint.altitude': 40, 'waypoint.tilt_angle': 0, 'waypoint.pan_angle': 0, 'waypoint.latitude': 15, 'waypoint.hold_time': 0, 'waypoint.yaw_from': 30, 'waypoint_type': 1, 'waypoint.pos_acc': 3} (type dict)
Service arguments are: [waypoint.latitude waypoint.longitude waypoint.altitude waypoint.pos_acc waypoint.speed_to waypoint.hold_time waypoint.yaw_from waypoint.pan_angle waypoint.tilt_angle waypoint.waypoint_type]
So I think I should send all the data in one group as the type waypoint
, but I don't know what to do...
Thanks