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

Error Using ArduPilotPlugin Iris URDF #23

Open
edmuthiah opened this issue Jun 6, 2020 · 4 comments
Open

Error Using ArduPilotPlugin Iris URDF #23

edmuthiah opened this issue Jun 6, 2020 · 4 comments

Comments

@edmuthiah
Copy link

edmuthiah commented Jun 6, 2020

I am currently trying to convert the Iris model.sdf to an urdf so that I can get RViz depth cloud visualizations when I add a depth camera. I was able to successfully convert the model.sdf to and urdf to get the correct collisions, visuals and inertias.
image

However I'm having trouble with the ardupilot plugin. I am able to establish a connection but sending takeoff commands does not work. The command is acknowledge but nothing happens in Gazebo.
image

This the current urdf:
model.txt

@edmuthiah edmuthiah changed the title Error Using ArduPilotPlugin With URDF Models Error Using ArduPilotPlugin Iris URDF Jun 6, 2020
@SwiftGust
Copy link
Owner

Hi,
I'm sorry but I don't get what you are trying to do.
How did you launched ArduPilot SITL with which command?
Are you sure you are running Gazebo-ArduPilot SITL?
Can you confirm vehicle attitude changes as it should be when you apply moment in gazebo side?

URDF is only useful in ROS side, using URDF to visualize robot in RVIZ is another thing to setup in RViz. You don't need collisions, inertial parameters to visualize.
I see you made a URDF version of iris that gazebo can convert(using gzsdf) but I don't think it is neccessary to create Gazebo compatible URDF file.

@edmuthiah
Copy link
Author

edmuthiah commented Jun 8, 2020

Hi @SwiftGust. The master SITL for the normal SDF iris model in Gazebo work fine for me. But I am trying to make it work in RViz also.

My goal: Add realsense depth camera URDF+ Gazebo Plugin to Iris in Gazebo AND visualise robot model + depth cloud in RViz.
My issue: RViz does not visualise SDF only URDF. To get point clouds in RViz you need the state to be published from an URDF robot. For example, when I added the realsense gazebo plugin to an URDF rover I was able to easily get a robot model + point cloud like so:
image

My attempt: With the iris drone in your repo, because it is defined in SDF, I cannot get a visualisation of the Robot Model or Depth Cloud in RViz.
image

So I tried to convert the Iris SDF to an URDF then add the ardupilot plugin (and then depth camera plugin).
image

image

The camera works but the ardupilot plugin does not. The URDF defined drone in gazebo connects to ardupilot but it does not take off. I'm not sure why it doesn't take off? But there is someone with a similar problem: khancyr#26


Is it possible to define the Iris + Ardupilot Gazebo Plugin in URDF instead of SDF?


Regarding your questions:

  1. I opened the new URDF Iris in gazebo using a launch file then ran sim_vehicle.py while in the arducopter folder.
  2. Yes, I'm quite sure the sitl is running.
  3. Yes, when i apply a 10N force to one of the rotors gazebo the joint spins.

I have sent you a message on gitter if you want to chat in more detail.

Here is the file I'm using:
model.txt

@SwiftGust
Copy link
Owner

SwiftGust commented Jun 9, 2020

Hi @ed-muthiah.
Thank you for detailed explanation.
It seems you are having no issue attaching depth camera to iris model and getting depth image & pointcloud from the depth camera as ROS topic.

To visualize your robot in RViz, you don't need to setup anything more in Gazebo side.
You just need to load robot model and setup tf frames in ROS side alone as described here
http://wiki.ros.org/rviz/DisplayTypes/RobotModel

P.S. I missed you already visualized your drone there but I will leave here for the others.

On the other hand, if you want to use URDF in Gazebo.
In the end you need SDF file for Gazebo simulation.
so the gz sdf command will give you check functionality of URDF file & conversion to SDF file. If Gazebo doesn't work properly please refer document described in http://gazebosim.org/tutorials?tut=ros_urdf&cat=connect_ros

So I think you should check this converted SDF file is correct in regarding plugin definition as same as in this repository.

@hamsterasu
Copy link

hamsterasu commented Aug 12, 2021

Hi @ed-muthiah , I took a look at your model.txt file and found that there's an error at all the rotor joints, i.e
<limit effort="0.0" lower="-1e+16" upper="1e+16" velocity="0.0"/>. The maximum effort and velocity are 0.0, which means they can't spin at all. I changed this line at all rotor joints to:
<limit effort="2000.0" lower="-1e+16" upper="1e+16" velocity="838.0"/>, and the drone was able to take off.

However, there is still a weird behaviour like when initialising the gyro, it takes a little long, whereas in the sdf version it was almost instantaneous.
Screenshot from 2021-08-12 15-11-31

Sometimes, the gyro does not even get initialised and I get this error :
Screenshot from 2021-08-12 15-24-18 .
gyro[0] did not converge: diff=-57.29578 dps (expected < 0.100000)
When this happens, the drone can take off but it keeps flying up forever.

It is no doubt a progress on what you've done though. Now, I just hope somebody has the answer to the gyro problem

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

No branches or pull requests

3 participants