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

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

Open
j0npas opened this issue Jan 21, 2021 · 5 comments
Open

Comments

@j0npas
Copy link

j0npas commented Jan 21, 2021

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...

@tinchjonathan
Copy link

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

@jacklu333333
Copy link

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

@j0npas
Copy link
Author

j0npas commented May 3, 2023

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!

@smithan7
Copy link

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

@jacklu333333
Copy link

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

Hope this will help you

Best Regards,
Jack Lu

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

4 participants