Giter Site home page Giter Site logo

Testing Mavlink 2 about mavlink HOT 10 CLOSED

kgmormylo avatar kgmormylo commented on August 27, 2024
Testing Mavlink 2

from mavlink.

Comments (10)

benbarkay avatar benbarkay commented on August 27, 2024

An exception stacktrace would be helpful :)

from mavlink.

kgmormylo avatar kgmormylo commented on August 27, 2024

Sorry, Ben. I edit message and add exception stack to it. But it didn't save.

Exception in thread "main" java.lang.IllegalStateException: Failed generate signature for packet
	at io.dronefleet.mavlink.protocol.MavlinkPacket.sign(MavlinkPacket.java:298)
	at io.dronefleet.mavlink.MavlinkConnection.send(MavlinkConnection.java:327)
	at simpleMavlink.Main.main(Main.java:157)
Caused by: java.security.DigestException: Length must be at least 32 for SHA-256digests
	at sun.security.provider.DigestBase.engineDigest(Unknown Source)
	at java.security.MessageDigest$Delegate.engineDigest(Unknown Source)
	at java.security.MessageDigest.digest(Unknown Source)
	at io.dronefleet.mavlink.protocol.MavlinkPacket.sign(MavlinkPacket.java:290)
	... 2 more

from mavlink.

Enlade avatar Enlade commented on August 27, 2024

I think you need to do a bunch more to set up the messages right? Like you are hitting a signing issue because you didn't set up the signatureConfiguration. I think there are other things you need to set up as well. Again, I just peaked at V2 so I didn't look into it too closely, but my understanding is that you need to do more with V2 than you would with V1 (just calling send()).

from mavlink.

Enlade avatar Enlade commented on August 27, 2024

You probably did some of this in the code you didn't provide that opens the connection. I see in the readme file that you need to set up the signing and other stuff in the following way (this is for sockets, were I am using serial, but it should be about the same). Do you do this?

    MavlinkConnection connection = MavlinkConnection.builder(socket.getInputStream(), socket.getOutputStream())
            
            // Dialects are associated to systems when a heartbeat is received. The heartbeat
            // informs us of the autopilot of the device, which tells us which dialect
            // that device adheres to.
            .dialect(MavAutopilot.MAV_AUTOPILOT_GENERIC, new StandardDialect())
            .dialect(MavAutopilot.MAV_AUTOPILOT_ARDUPILOTMEGA, new ArdupilotmegaDialect())
            
            // When specifying signing configuration, every Mavlink2Message that is send
            // through this connection will be signed. We will need to setup signing
            // by sending Mavlink1 messages before we can communicate with Mavlink2 messages.
            .signing(new SigningConfiguration(
                    0, // This is the initial timestamp for signing, We should only specify
                                // a value other than 0 if we do not trust that our system's clock is
                                // going to be calibrated prior to the connection. Generally, this value
                                // is loaded from persistence (where the last signature timestamp is stored)

                    1,    // The signing link ID. Generally, this should be connection-bound. So if there
                                // is more than a single connection, each of them has to have a different value.

                    // Secret key, should be 36 bytes in length. The specification recommends using a
                    // SHA-256'd passphrase.
                    MessageDigest.getInstance("SHA-256")
                            .digest("my secret key".getBytes(StandardCharsets.UTF_8))
            ))
            .build();

from mavlink.

kgmormylo avatar kgmormylo commented on August 27, 2024

Enlade, i copy example and after that add my code that you could see here in while loop

from mavlink.

Enlade avatar Enlade commented on August 27, 2024

The key in the example "my secret key" isn't 36 bytes in length. So, maybe try changing it to something that is 36 in length if you haven't done that already?

Not sure that I'm reading that right, but maybe it needs to be 32 bytes. Might as well try it.

from mavlink.

kgmormylo avatar kgmormylo commented on August 27, 2024

I am not sure. But i already try expand this string - my secret key.
It's not help.

from mavlink.

kgmormylo avatar kgmormylo commented on August 27, 2024

Hey, guys. Do you have any ideas? When i commend sing method call error disappeared.

from mavlink.

benbarkay avatar benbarkay commented on August 27, 2024

It looks like there's something else with signing that isn't right. If you can do without signing for a while then I'll be able to properly test and fix this within a couple of weeks.

from mavlink.

kgmormylo avatar kgmormylo commented on August 27, 2024

thanks, Ben. i am looking forward in update. If you need any help write me and good luck.

from mavlink.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.