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

Java generator hard-codes sysid and compid #805

Closed
markdjacobsen opened this issue Nov 23, 2017 · 3 comments
Closed

Java generator hard-codes sysid and compid #805

markdjacobsen opened this issue Nov 23, 2017 · 3 comments

Comments

@markdjacobsen
Copy link

The Java code generator hard-codes a sysid of 255 and compid of 190, overwriting a user-specified sysid or compid. For example, this is the msg_heartbeat packing function:

public MAVLinkPacket pack(){
        MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH);
        packet.sysid = 255;
        packet.compid = 190;
        packet.msgid = MAVLINK_MSG_ID_HEARTBEAT;
              
        packet.payload.putUnsignedInt(custom_mode);
              
        packet.payload.putUnsignedByte(type);
              
        packet.payload.putUnsignedByte(autopilot);
              
        packet.payload.putUnsignedByte(base_mode);
              
        packet.payload.putUnsignedByte(system_status);
              
        packet.payload.putUnsignedByte(mavlink_version);
        
        return packet;
    }

This was most likely implemented because Java is typically used for a GCS, but that is not always the case. In my case, I am creating a mock drone in Java. It makes sense that these values could be used as defaults, but should not be hard-coded into packing functions.

My recommendation is to make these defaults in MAVLinkMessage, and remove them from the subclassed message packing functions.

@amilcarlucas
Copy link
Collaborator

@hamishwillee This is a pymavlink issue that should be reported upstream to https://github.com/ardupilot/pymavlink/issues and closed here.

@hamishwillee
Copy link
Collaborator

@jacobsenmd Can you please report upstream as per #805 (comment)

@markdjacobsen
Copy link
Author

Moved to ArduPilot/pymavlink#160

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

3 participants