Connecting to drone simulation, Java

Hi everyone,

I’ve installed gazebo and PX4 in my windows machine, using wsl. In my Java program, I have added the io.mavsdk:mavsdk:1.3.1 dependency.

When I create an instance of the System class, and try to send commands, nothing happens

I’ve different ports with no success. Any help?

Keep in mind, I’m creating a desktop app, not an android one

Can you share the connection code?

Let me ping @JonasVautherin as he might be able to help with this.

 void fun Drone(int port) {
        // Connect to the drone
        System drone = new System("localhost", port);

        drone.getAction().takeoff();
}
dependencies {

    // MAVSDK-Java dependencies
    implementation("io.mavsdk:mavsdk:1.3.1")
    implementation("io.dronefleet.mavlink:mavlink:1.1.11")

    // SLF4J binding
    implementation("org.slf4j:slf4j-api:2.0.5")

    // Logback logging framework
    implementation("ch.qos.logback:logback-core:1.4.6")
    implementation("ch.qos.logback:logback-classic:1.4.6")
}

Can you share more of the code where you actually call Drone and with what port argument?

And are you aware of this example?

I have included all dependencies which you have mentioned above still, I’m getting this error:

import org.slf4j.Logger
The import org.slf4j.Logger cannot be resolved.

import org.slf4j.LoggerFactory;
The import org.slf4j.LoggerFactory cannot be resolved.

how to build this project as maven or java.I made maven project added dependencies in POM.xml file.

Thanks in advance.