khancyr / ardupilot_gazebo

GNU General Public License v3.0
56 stars 253 forks source link

Error Using ArduPilotPlugin With URDF Models #26

Open blakermchale opened 4 years ago

blakermchale commented 4 years ago

I am currently working on getting the ardupilot plugin to work with multiple UAVs that are launched via URDF files. I was able to transition the SDF models to URDFs that spawn correctly and output all of the expected topics (imu topic, camera topic). The models make a connection with the ardupilot side and all of the SITL consoles launch appropriately without error. However, I cannot successfully get the UAV to arm and then takeoff. With the SDF models it works. One difference I see between the two cases, SDF and URDF, is that in the console for URDF ardupilot this error is constantly output "APM: PreArm: Accels inconsistent". Another difference is that when I send an "arm throttle" it shows "Got MAVLink msg: COMMAND_ACK {command : 400, result : 4}" instead of "Got MAVLink msg: COMMAND_ACK {command : 400, result : 0}". Any tips or examples on how to resolve this issue and get the URDF models to fly appropriately?

edmuthiah commented 4 years ago

@blakermchale Hi Blake, I have an identical issue with the iris drone. Converted SDF to URDF and got a connection with ArduPilot but no response to takeoff messages in Gazebo. Did you manage to figure this out? image

blakermchale commented 4 years ago

Hey Ed, I did not end up finding a solution to getting a good connection with the URDF file. I read through your issue on SwiftGust repo above. I ended up just using the SDF file directly like SwiftGust mentions. I tried to debug the issue myself and found that it seems to be an issue with the gazebo ros factory spawn service. I passed both an SDF and URDF to this spawning method and both had the same error as before.

linuxsocke commented 4 years ago

I converted the sdf to a urdf file and spawned the model within gazebo-ros. So it should work.

edmuthiah commented 4 years ago

@linuxsocke could you share the code if it does work? I got pretty close but couldn't get the RViz setup correctly.

linuxsocke commented 4 years ago

@ed-muthiah So what I did is taking the urdf examples from the rotors_simulator and adopted the plugins required for ardupilot. So I only had an issue when adding the imu but the tutorial helped me out.

As I told. Using urdf I can load in my mav and with mavproxy I can arm and takeoff.

edmuthiah commented 4 years ago

@linuxsocke

  1. Are you using the Iris drone?
  2. Do you get an RViz visualisation too?
  3. Have you tested with other mavproxy commands other than arm and takeoff? Does you drone continue to drift upwards?
  4. Could you please submit a code to this repo if you are willing :)

Thanks.

linuxsocke commented 4 years ago

I just took the urdf files from the rotors_simulator and substituted the imu and ardupilot plugin. Codewise it should work straight forward. I did not tested it yet on rviz.

linuxsocke commented 4 years ago

@ed-muthiah Maybe I can later show working code. But right now its quite a lot and I want to shorten it a bit first.

edmuthiah commented 4 years ago

@linuxsocke @blakermchale This should work but no RViz visualisation because that requires setting up a world and odom frame. Would be cool if you guys can help with this.

image

rename the extension to be .urdf eddy.txt

standmit commented 2 years ago

I had a similar problem. This solution helped me: https://github.com/SwiftGust/ardupilot_gazebo/issues/23#issuecomment-897408364

yangzhaotong1996 commented 5 months ago

@edmuthiah hello sir can you share your launch file about ArduPilotPlugin With URDF Models