sim_cf icon indicating copy to clipboard operation
sim_cf copied to clipboard

Unclear on how to retrieve drone location

Open Arpafaucon opened this issue 6 years ago • 5 comments

I wasn't able to understand how we are supposed to get the drone positions. explored options :

  • tf
    in the current setup, no transforms are published. I believe that is quite weird given what I understood from the internals of crazyflie_driver. And from you crazyflie.py module ( that had by the way a weird way to handle constructor arguments, see crazyflie.tool module where I tried to correct it...but without tf it still doesn`t work

  • /cf/local_position topic That way I get a 6-d vector, the 3 first being the pose. However, the last three don't seem to map to roll, pitch, yaw. According to crazyflie_add_single.launch , these value correspond to

    "stabilizer.roll", "stabilizer.pitch", "stabilizer.yaw"

    Although the models in gazebo are perfectly horizontal, those values (roll, pitch) are non-null.

  • cf/pose topic (mentionned in crazyflie_visu.rviz file) I don't have this topic

Do you have any advice on that matter? That might be useful to mention that in the documentation

Arpafaucon avatar Feb 14 '19 19:02 Arpafaucon

  • /cf/pose in crazyflie_visu.rviz is an old version when I was still using pose to publish position information. It shouldn't be in the recent sim_cf version normally.
  • /cf/local_position is 6-d vector. the first 3 being the position and the 3 last are roll, pitch, yaw values in degree not radians. So even when in gazebo it's perfectly horizontal, gazebo sends the true sensors values with some noises. This is why you won't have null value for these even when it is on the ground. What is the range of these values ? (don't forget it's in degree)
  • tf : well tbh this was a choice of design to get rid of it. There is the issue : I wanted the user to be able to choose by himself the logs he wanted to obtain from crazyflie. And you may have noticed it, general logs are obtained via the GenericLog (as in crazyflie_add_single.launch) and the data you obtain are sent in a vector. the pose is obtained using this, that's why it doesn't have any tf. However, you can create a ros node that subscribe to that topic and convert that vector to a pose with the tf you want. The last sim_cf version was doing that by fetching automatically the position and euler angles (hard coded), but I noticed it takes a lot of bandwidth and getting too much log can affect performances that's why I let the user the possibility to specify what he want (maybe just x,y,z without angles or x,z it's up to him). The less log the better I believe

wuwushrek avatar Feb 15 '19 18:02 wuwushrek

A bit late, but thanks ! That might deserve another issue: the logging topic /cf/local_position sometimes returns zero values instead of the correct position.

Expected behaviour

Get consistent position messages in the same (say) second

Observed behaviour

Some messages are produced with zero-only values. In the following examle, they are the even-numbered seq.

# cf1 is simulated
$ rostopic echo /cf1/local_position
  stamp:
    secs: 293
    nsecs: 628000000
  frame_id: "cf1/base_link"
values: [0.9986013770103455, 0.998471200466156, 0.03146503120660782, -0.14742575585842133, -0.18336021900177002, -0.08680407702922821]
---
header:
  seq: 58658
  stamp:
    secs: 293
    nsecs: 630000000
  frame_id: "cf1/base_link"
values: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
---
header:
  seq: 58659
  stamp:
    secs: 293
    nsecs: 630000000
  frame_id: "cf1/base_link"
values: [0.9986578226089478, 0.9985325932502747, 0.03146322816610336, -0.1475960612297058, -0.18361333012580872, -0.08645530790090561]
---
header:
  seq: 58660
  stamp:
    secs: 293
    nsecs: 636000000
  frame_id: "cf1/base_link"
values: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
---
^Cheader:
  seq: 58661
  stamp:
    secs: 293
    nsecs: 640000000
  frame_id: "cf1/base_link"
values: [0.9986107349395752, 0.9984825849533081, 0.03145763278007507, -0.14709217846393585, -0.18389186263084412, -0.08607463538646698]
---
header:
  seq: 58662
  stamp:
    secs: 293
    nsecs: 642000000
  frame_id: "cf1/base_link"
values: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
---
header:
  seq: 58663
  stamp:
    secs: 293
    nsecs: 642000000
  frame_id: "cf1/base_link"
values: [0.9985549449920654, 0.998424768447876, 0.03145177662372589, -0.14745797216892242, -0.18474014103412628, -0.08621597290039062]
---

Arpafaucon avatar Feb 26 '19 22:02 Arpafaucon

I solved this ! I'm going to push a commit when I will have a viable solution for this issue "Gazebo crash on /delete_model service calls"

wuwushrek avatar Mar 22 '19 15:03 wuwushrek

I am running the max_cf_sitl.launch file. Any idea how to retrieve the drone location ?. I have tried with /cf1/local_position topic, but no messages on that topic

surendhar091992 avatar Jul 05 '22 10:07 surendhar091992

There is no such a topic to retrieve drone location. Is anyone able to get it?

hasankivrak avatar Jan 09 '23 02:01 hasankivrak