Dronecode SDK, telemetry data problem with obtaining position

Hi, I used the code from the photo to get the cordinates in gimbal test file. It works and gives me values back, but when I am moving the code to different file location (as a template I am using one of the examples (take off and land)) I get NaN. I know that I reach telemetry becouse I get value of telemetry->in_air() when drone is in the air. Where should I search for the problem, is there a possibility of getting telemetry data without QGC?

Also, If I am using make px4_sitl_default gazebo it is working, but if I run as MAVROS it is saying NaN,
for MAVROS I am using port 14540 and for Dronecode 14550.

I found my error, while I taught that it is enough to call ./gimbal udp://:14550
I found that in file I made a mistake:

std::string connection_url=“udp://0.0.0.0:14550”;
where should be:
std::string connection_url=“udp://127.0.0.1:14550”;

1 Like

Interesting, can you describe your network setup? Or maybe paste the output of ip addr show?

I am working on SITL that runs on one PC, so actually I am using only localnetwork of my PC

It’s still odd because I have not seen this problem before. Usually udp://:14550 works fine.

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 50:7b:9d:5d:30:14 brd ff:ff:ff:ff:ff:ff
inet 10.0.165.19/23 brd 10.0.165.255 scope global dynamic noprefixroute enp0s25
valid_lft 12107sec preferred_lft 12107sec
inet6 fe80::5e27:f747:d911:e816/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: wlp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 30:52:cb:70:97:0b brd ff:ff:ff:ff:ff:ff
inet 10.42.0.1/24 brd 10.42.0.255 scope global noprefixroute wlp4s0
valid_lft forever preferred_lft forever
inet6 fe80::57b9:e21f:98ac:e24/64 scope link noprefixroute
valid_lft forever preferred_lft forever
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:14:f8:bb brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN group default qlen 1000

Thanks for the ip addr show output. I actually have almost the same output on my Fedora laptop. The device names are obviously different, as well as MAC addresses and IPs, the rest is identical.

I’ve tested this with the follow add_any_connection() arguments against SITL Gazebo and they all worked:
udp://:14540
udp://0.0.0.0:14540
udp://127.0.0.1:14540
udp://:14550
udp://0.0.0.0:14550
udp://127.0.0.1:14550

I tested this using an integration test, not an example but I don’t see how that should be different.

Could you paste the SDK version that you’re using? It should show up on library load, e.g.:

[03:41:39|Info ] DronecodeSDK version: 0.16.0-78-g1cf4c58e-dirty (dronecode_sdk_impl.cpp:25)
```

[08:25:19|Info ] DronecodeSDK version: 0.15.0 (dronecode_sdk_impl.cpp:25)

Maybe the reason is that I am using UDP port 14550 and 14540 for MavRos?

You could try if the behaviour is the same if MAVROS is not running.

I remember that It worked, with default parametrs, but I needed both (generaly I need mavros, but dronecode for gimbal ROI control). After switching to 14550 port the issue happend.

As I wrote above I tested both ports, so I’m not sure why it happens for you.

I don’t know, but as I said, by now it works, with this, maybe some problems with my code. For the HITL I will not need this, becouse I can post my ROI directly to gimbal controller. Dronecode SDK for me is only for SITL purpose.

1 Like