Qwiic_Ublox_Gps_Py icon indicating copy to clipboard operation
Qwiic_Ublox_Gps_Py copied to clipboard

Example 5 producing error, object has no attribute "ubx_get_set_del"

Open j0npas opened this issue 4 years ago • 5 comments

ubx_get_val exists in ublox_gps.py but not ubx_get_set_del. Would be helpful to have this example work, unless I'm doing something wrong...

j0npas avatar Jan 21 '21 17:01 j0npas

I'm having the same problem. Any advice would be extremely helpful.

tinchjonathan avatar Dec 15 '21 18:12 tinchjonathan

Hi guys, Since the participants are just you two, I guess SaprkFun doesn't plan to solve in a short time. I found the function in old commit. However, I am not sure the code is validate or not.

def ubx_get_set_del(self, key):

        key_bytes = bytes([])
        if type(key) != bytes:
            while key > 0: 
                key_bytes = key_bytes + bytes([(key & 0xFF)])
                key = key >> 8 

        key_bytes = key_bytes[::-1]
        msg = self.send_message(sp.CFG_CLS, 0x8b, key_bytes)
        parse_tool = core.Parser([sp.CFG_CLS, sp.ACK_CLS])
        msg = parse_tool.receive_from(self.hard_port) 
        return(msg)

Hope this will somehow helps

Best Regards, Jack Lu

jacklu333333 avatar May 03 '23 10:05 jacklu333333

Hi guys, Since the participants are just you two, I guess SaprkFun doesn't plan to solve in a short time. I found the function in old commit. However, I am not sure the code is validate or not.

def ubx_get_set_del(self, key):

        key_bytes = bytes([])
        if type(key) != bytes:
            while key > 0: 
                key_bytes = key_bytes + bytes([(key & 0xFF)])
                key = key >> 8 

        key_bytes = key_bytes[::-1]
        msg = self.send_message(sp.CFG_CLS, 0x8b, key_bytes)
        parse_tool = core.Parser([sp.CFG_CLS, sp.ACK_CLS])
        msg = parse_tool.receive_from(self.hard_port) 
        return(msg)

Hope this will somehow helps

Best Regards, Jack Lu

Thanks for suggesting this, Jack. I'll be getting back into Ublox stuff shortly and I'll give it a try. I appreciate the help!

j0npas avatar May 03 '23 13:05 j0npas

Adding that function into ublox_gps.py allows example 5 to run. However, it is very similar to the ublox_gps.py function "get_val" shown below: def ubx_get_val(self, key_id): """ This function takes the given key id and breakes it into individual bytes which are then cocantenated together. This payload is then sent along with the CFG Class and VALGET Message ID to send_message(). Ublox Messages are then parsed for the requested values or a NAK signifying a problem.

    :return: The requested payload or a NAK on failure.
    :rtype: namedtuple
    """
    key_id_bytes = bytes([])
    if type(key_id) != bytes:
        while key_id > 0:
            key_id_bytes = key_id_bytes + bytes([(key_id & 0xFF)])
            key_id = key_id >> 8

    key_id_bytes = key_id_bytes[::-1]
    msg = self.send_message(sp.CFG_CLS, self.cfg_ms.get('VALGET'), key_id_bytes)
    parse_tool = core.Parser([sp.CFG_CLS, sp.ACK_CLS])
    msg = parse_tool.receive_from(self.hard_port)
    return msg

When I run them both side by side with the same key, I get the same output:

get_val: ('ACK', 'NAK', NAK(clsID=6, msgID=139)) get_set_del: ('ACK', 'NAK', NAK(clsID=6, msgID=139))

However, if I change the msg key to 0x30210001 for CFG-RATE-MEAS I still get:

get_val: ('ACK', 'NAK', NAK(clsID=6, msgID=139)) get_set_del: ('ACK', 'NAK', NAK(clsID=6, msgID=139))

which was surprising - I expected them to be different unless this is some type of error msg?

It's also not obvious how to use this to update the CFG-RATE-MEAS

smithan7 avatar Jul 29 '23 12:07 smithan7

@smithan7, I would suggest use pyubx2. It is relatively robust.

Hope this will help you

Best Regards, Jack Lu

jacklu333333 avatar Jul 31 '23 05:07 jacklu333333