semuconsulting / pyubx2

Python library for parsing and generating UBX GPS/GNSS protocol messages.
BSD 3-Clause "New" or "Revised" License
175 stars 68 forks source link

Changing the minElev parameter #161

Closed praveengi113 closed 1 month ago

praveengi113 commented 1 month ago

Hi there, I'm Praveen, I'm using the pyubx2 to interface with the UBLOX Neo M8N receiver. I'm trying to change the elevation mask of the receiver by using the below message.

cfg_nav5 = UBXMessage( "CFG", # Message class "CFG-NAV5", # Message ID mask=0x0020, # Mask indicating we're updating the minElev field dynModel=3, # Dynamic Model (portable, can be adjusted if needed) fixMode=3, # Fix mode (3D-only, adjust if necessary) minElev=mask # Minimum Elevation Mask in degrees )

With this my message is getting acknowledged by the receiver. But the value of minElev is not getting changed.

semuadmin commented 1 month ago

Hi @praveengi113

Can you please include your complete Python script and confirm which firmware version your M8N is running? Thanks

I can see there are a number of issues with the code snippet you've provided. I recommend having another look at the pyubx2 README, specifically the section about message generation and the message definition for the CFG-NAV5 message.

By way of comparison, here's a script that I've just successfully tested on an NEO-M8N receiver running firmware SPG 3.01 Protocol 18.00 (this arbitrarily sets the minElev value to 65 degrees - the default value is 5 degrees):

from serial import Serial
from pyubx2 import UBXMessage, SET

cfg_nav5 = UBXMessage(
    "CFG",  # Message class
    "CFG-NAV5",  # Message ID
    SET,  # msgmode must be 'SET' (0x01)
    dyn=1,  # set dynamic model mask bit
    minEl=1,  # set minimum elevation mask bit
    posFixMode=0,
    drLim=0,
    posMask=0,
    timeMask=0,
    staticHoldMask=0,
    dgpsMask=0,
    cnoThreshold=0,
    utc=0,
    dynModel=3,  # Dynamic Model (portable, can be adjusted if needed)
    fixMode=3,  # Fix mode (3D-only, adjust if necessary)
    fixedAlt=0.0,
    fixedAltVar=1.0,
    minElev=65,  # required value of minimum elevation in degrees
    drLimit=0,
    pDop=25.0,
    tDop=25.0,
    pAcc=100,
    tAcc=350,
    staticHoldThresh=0,
    dgnssTimeOut=60,
    cnoThreshNumSVs=0,
    cnoThresh=0,
    staticHoldMaxDist=0,
    utcStandard=0,
)

with Serial("/dev/tty.usbmodem1201", 38400, timeout=3) as stream:
    stream.write(cfg_nav5.serialize())

Confirmation from PyGPSClient that settings have been applied:

Screenshot 2024-10-13 at 09 08 00