Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to call ros service #3805

Closed
abdo-ameen opened this issue Jun 20, 2021 · 3 comments · Fixed by #3880
Closed

How to call ros service #3805

abdo-ameen opened this issue Jun 20, 2021 · 3 comments · Fixed by #3880

Comments

@abdo-ameen
Copy link

abdo-ameen commented Jun 20, 2021

Question

How to call ros services the right way?

Include context on what you are trying to achieve

I'm just trying to call ros services like /airsim_node/gps_goal or /airsim_node/local_position_goal but they return errors.

1- First I run my Unreal Blocks environment, press play button
2- launch /airsim_node after setting up the terminal
source devel/setup.bash
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
export WSL_HOST_IP=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}')
roslaunch airsim_ros_pkgs airsim_node.launch output:=screen host:=$WSL_HOST_IP

3- launch /pid_position_node
roslaunch airsim_ros_pkgs position_controller_simple.launch

4- calling the service with its arguments rosservice call /airsim_node/gps_goal 5 10 15 1 drone_1 returns success: False message: ''

5- calling service rosservice call /airsim_node/local_position_goal 10 15 20 2 drone_1 returns ERROR: service [/airsim_node/gps_goal] responded with an error: and the /pid_position_node will loop forever printing out [PIDPositionController] Moving to goal. but never moving the drone
image

6- calling /airsim_node/takeoff 1 does move the drone but also return success: Flase

I'm I doing something wrong here? I'm I missing something? The documentations provide no more explanations on ros services.

Context details

OS: Windows10 with WSL2 running Ubuntu 18.04 and ROS Melodic
AirSim: 1.5
Python: 3.6
Unreal: 4.26

settings.json:
{
"SeeDocsAt": "https://github.com/Microsoft/AirSim/blob/master/docs/settings.md",
"SettingsVersion": 1.2,
"SimMode": "Multirotor",
"ViewMode": "Fpv",
"ClockSpeed": 1.0,
"Vehicles": {
"drone_1": {
"VehicleType": "SimpleFlight",
"DefaultVehicleState": "Armed",
"EnableCollisionPassthrogh": false,
"EnableCollisions": true,
"AllowAPIAlways": true,
"RC": {
"RemoteControlID": 0,
"AllowAPIWhenDisconnected": false
},
"Sensors": {
"Imu" : {
"SensorType": 2,
"Enabled": true
},
"Barometer":{
"SensorType": 1,
"Enabled": true,
"PressureFactorSigma": 0.0001825
},
"Gps": {
"SensorType": 3,
"Enabled" : true,
"EphTimeConstant": 0.9,
"EpvTimeConstant": 0.9,
"EphInitial": 25,
"EpvInitial": 25,
"EphFinal": 0.1,
"EpvFinal": 0.1,
"EphMin3d": 3,
"EphMin2d": 4,
"UpdateLatency": 0.2,
"UpdateFrequency": 50,
"StartupDelay": 1
},
"Magnetometer": {
"SensorType": 4,
"Enabled" : true,
"NoiseSigma": 0.005,
"ScaleFactor": 1,
"NoiseBias": 0,
"UpdateLatency": 0,
"UpdateFrequency": 50,
"StartupDelay": 0
},
"LidarCustom": {
"SensorType": 6,
"Enabled": true,
"NumberOfChannels": 16,
"PointsPerSecond": 10000,
"X": 0,
"Y": 0,
"Z": -1,
"DrawDebugPoints": true
}
},
"Cameras": {
"front_center_custom": {
"CaptureSettings": [
{
"PublishToRos": 1,
"ImageType": 0,
"Width": 640,
"Height": 480,
"FOV_Degrees": 27,
"DepthOfFieldFstop": 2.8,
"DepthOfFieldFocalDistance": 200.0,
"DepthOfFieldFocalRegion": 200.0,
"TargetGamma": 1.5
}
],
"X": 0.50, "Y": 0, "Z": 0.10,
"Pitch": 0, "Roll": 0, "Yaw": 0
},
"front_left_custom": {
"CaptureSettings": [
{
"PublishToRos": 1,
"ImageType": 0,
"Width": 672,
"Height": 376,
"FOV_Degrees": 90,
"TargetGamma": 1.5
},
{
"PublishToRos": 1,
"ImageType": 1,
"Width": 672,
"Height": 376,
"FOV_Degrees": 90,
"TargetGamma": 1.5
}
],
"X": 0.50, "Y": -0.06, "Z": 0.10,
"Pitch": 0.0, "Roll": 0.0, "Yaw": 0.0
},
"front_right_custom": {
"CaptureSettings": [
{
"PublishToRos": 1,
"ImageType": 0,
"Width": 672,
"Height": 376,
"FOV_Degrees": 90,
"TargetGamma": 1.5
}
],
"X": 0.50, "Y": 0.06, "Z": 0.10,
"Pitch": 0.0, "Roll": 0.0, "Yaw": 0.0
}
},
"X": 2, "Y": 0, "Z": 0,
"Pitch": 0, "Roll": 0, "Yaw": 0
}
},
"SubWindows": [
{"WindowID": 0, "ImageType": 0, "CameraName": "front_left_custom", "Visible": false},
{"WindowID": 1, "ImageType": 0, "CameraName": "front_center_custom", "Visible": false},
{"WindowID": 2, "ImageType": 0, "CameraName": "front_right_custom", "Visible": false}
]
}

Include details of what you already did to find answers

I tried with different ROS versions, Kinetic, Melodic and Noetic.
I tried with different arguments.

@Yousri96
Copy link

hi, have you found any solutions yet?
i have the same problem

@abdo-ameen
Copy link
Author

Nope, no response from the maintainers yet.

@zimmy87
Copy link
Contributor

zimmy87 commented Jul 14, 2021

Hi @abdo-ameen, thank you for filing this issue and welcome! There are some things of note concerning this scenario:

  1. Currently some of the topic names in PIDPositionController and AirsimROSWrapper are wrong and need updating. I've published a PR for fixing the topic names relevant to this scenario: fix ROS topic names #3880. Please apply my fix and test your repro steps again.
  2. While debugging this scenario, I also ran into ROS node "pid_position_controller_simple_node" and launch file "airsim_with_simple_PD_position_controller.launch"  #2789. My fix in fix ROS topic names #3880 depends upon and includes the fix for that issue as well.
  3. Since AirSim uses a NED coordinate system, the call to the /airsim_node/local_position_goal service in step 5 references a target position that is underground. You will most likely want to specify a negative z coordinate, for example, rosservice call /airsim_node/local_position_goal -- 10 15 -20 2 drone_1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants