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

Change UDP communications address to localhost from '192.168.46.2'. #2

Open
straycat11 opened this issue Jan 12, 2022 · 2 comments
Open

Comments

@straycat11
Copy link

Hello,
I have a Simulink model of a quadcopter which has the required infrastructure to send data to and receive from PX4 sitl. I connect the s-function block, the model compiles successfully; however, UDP communication is not established.

I changed the following line in PX4Main.c from:

_server.sin_addr.S_un.S_addr = inet_addr("192.168.46.2");
to
_server.sin_addr.S_un.S_addr = inet_addr("127.0.0.1");

I create the mex file using 'BuildPX4Interface.m'.

I am not using a Ubuntu machine to run the px4 software by the way. It simply runs as a separate window after I type 'make px4_sitl none'. The only message after I am getting 'Simulator connected on TCP port 4560.' is

ERROR [simulator] poll timeout 0, 111

Thanks in advance.

@straycat11
Copy link
Author

I was in fact able to change the ip to 'localhost' and managed to get a connection. The problem had stemmed from the interface being designed for a previous version of PX4 Firmware. I installed 'PX4.Windows.Cygwin.Toolchain.0.5' and checked out release v1.8.2. The problem I am having now is not the sensor data not being synchronous. I am getting the following errors:
...

WARN [sensors] Remaining sensors after failover event 0: Accel #0 priority: 1
WARN [sensors] Remaining sensors after failover event 0: Accel #1 priority: 1
ERROR [sensors] Gyro #0 fail: TIMEOUT!
ERROR [sensors] Sensor Gyro #0 failed. Reconfiguring sensor priorities.
WARN [sensors] Remaining sensors after failover event 0: Gyro #0 priority: 1
ERROR [sensors] Accel #0 fail: TIMEOUT!
ERROR [sensors] Sensor Accel #0 failed. Reconfiguring sensor priorities.
WARN [sensors] Remaining sensors after failover event 0: Accel #0 priority: 1
WARN [sensors] Remaining sensors after failover event 0: Accel #1 priority: 1

...

I tried running my Simulation running at 250 Hz (It used to run at 480 Hz); however, it did not solve the problem.

@aogrcs
Copy link

aogrcs commented Jun 16, 2023

Could you give me a tutorial about how to write s-funtion for IMU block, thanks!
@straycat11

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

2 participants