Px4-autopilot: How to create simulator server not on localhost

Created on 27 Jul 2020  路  2Comments  路  Source: PX4/PX4-Autopilot

Hello,

We want to create a simulator server (accepting clients on tcp port 4560, refer to image below) not on localhost.

image

In simulator_mavlink.cpp we see that the client connects to _myaddr, which is initialized to:
_myaddr.sin_addr.s_addr = htonl(INADDR_ANY);
As we understand, INADDR_ANY is normally routed to loopback address. Hence, our question is, how do we define our own ip?

Thanks,
Eyal

question sitl stale

Most helpful comment

Hi Eyal,

We ran into exactly the same problem. I have sent a pull request with our solution here: https://github.com/PX4/Firmware/pull/15443

Afterwards you can set the desired host in your rcS startup script (Firmware/ROMFS/px4fmu_common/init.d-posix/rcS), by changing simulator start -c $simulator_tcp_port into simulator start -t "192.168.178.122" $simulator_tcp_port.

Hope this helps!

Regards,
Peter

All 2 comments

Hi Eyal,

We ran into exactly the same problem. I have sent a pull request with our solution here: https://github.com/PX4/Firmware/pull/15443

Afterwards you can set the desired host in your rcS startup script (Firmware/ROMFS/px4fmu_common/init.d-posix/rcS), by changing simulator start -c $simulator_tcp_port into simulator start -t "192.168.178.122" $simulator_tcp_port.

Hope this helps!

Regards,
Peter

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jinchengde picture jinchengde  路  31Comments

LJ0707 picture LJ0707  路  29Comments

nicovanduijn picture nicovanduijn  路  32Comments

Stifael picture Stifael  路  34Comments

zalessio picture zalessio  路  33Comments