ethz-asl / ethzasl_xsens_driver

Driver for xsens IMUs
BSD 2-Clause "Simplified" License
102 stars 112 forks source link

ResetOrientation(0x0001) -> Error 0x21 "An invalid parameter is supplied" #88

Open amastrobera opened 6 years ago

amastrobera commented 6 years ago

I try to use the API to reset the heading, just like in the GUI. I saw in the user manual that the request to launch should be done in either config or measurement mode, with code = 0x0001, and your API does this.

    def ResetOrientation(self, code):
        """Reset the orientation.
        Code can take several values:
            0x0000: store current settings (only in config mode),
            0x0001: heading reset (NOT supported by MTi-G),
            0x0003: object reset.
        """
        print "msg: 0x%02X, code: 0x%02X " % (MID.ResetOrientation, code)
        data = struct.pack('!H', code)
        self.write_ack(MID.ResetOrientation, data)

If I am not mistaken, there could be a problem with packet += struct.pack('!B', 0xFF & (-(sum(map(ord, packet[1:]))))) in mtdevice.py. This request coming out of that code should be '\xfa\xff\xa4\x02\x00\x01\x5A' (as in DataView on the GUI) but is actually '\xfa\xff\xa4\x02\x00\x01Z'.

I think that is the beginning of an investigation.

amastrobera commented 6 years ago

FYI @bdholt1 @LukePhairatt

amastrobera commented 6 years ago

@fcolas has anyone looked at this ?

fcolas commented 6 years ago

@amastrobera I have good confidence that the checksum code is correct here (because that's a direct transliteration of the manual and because otherwise there would have been issues since a while. And in your particular examples, it happens that ascii for 'Z' is 5A thus both strings are identical.

For your actual issue, is it working with the GUI? Are you sure it's actually sending the request and not hiding error messages? What is your IMU? Are you sure this is supported?

As a side note, please include the problem description in the body of the issue and not only in the title. That way, it is more legible and you can actually describe what is happening.

snakehaihai commented 5 years ago

@amastrobera Go windows download xsense suit. Open MT manager. Increase baud rate to 921600. At output config, change to some default setting in the drop list. see if it works. After that, select only the parameters you needed.