Giter VIP home page Giter VIP logo

pyg5's People

Contributors

blauret avatar crazyknightgr avatar timsschoen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pyg5's Issues

Thanks for pyG5 codebase it looks great... I have questions if u dont mind

Hi Ben:
THANKS ! I have learned allot from you and your apps
I like your pyG5 apps very much
I have made my own listener in network manager to recv a udp pickled dictionary sent from my JerryGCS app over UDP on github: https://github.com/jerryfat/JerryGCS is not up to date yet I am on ver 139
Thanks for your clver and neat code, still trying to understand it all, very nice job
I dont understand how you update or what you update when you get new data from xplane
I am using PX4 JMavSim, QGCS over mavlink and my app sends attitude pickle dict based on dronekit and PyQt5
I see you emit a signal but I dont understand how it works yet.
If you can explain or give me hint
I am classic UNIX C/C++ trained and love Python and PyQt5, it took long time and effort to build my app.
I can open a hundred windows to monitor mavlink data messages from PX JMAVSiim

as a test I added to pyG5Network.py:

class pyG5_PX4_UDPListener(QObject):
"""pyG5_PX4_UDPListener Object.

Args:
    parent: Parent Widget

Returns:
    self
"""
xpInstance = pyqtSignal(QHostAddress, int)
drefUpdate = pyqtSignal(dict) # will only bind if in a class and is instantiated

def __init__(self, parent=None):
    print("inside class pyG5_PX4_UDPListener(QObject): __init__")
    """Object constructor.
    
    Args:
        parent: Parent Widget

    Returns:
        self
    """
    QObject.__init__(self, parent)

    self.logger = logging.getLogger(self.__class__.__name__)

    self.XPAddr = QHostAddress("127.0.0.1") #"239.255.1.1")
    self.XPPort = 65432 #49707

    # create the socket
    self.udpSock = QUdpSocket(self)

    self.udpSock.stateChanged.connect(self.stateChangedSlot)
    self.udpSock.readyRead.connect(self.udpData)
    self.udpSock.connected.connect(self.connectedSlot)
    self.udpSock.bind(QHostAddress.Null, self.XPPort, QUdpSocket.ShareAddress) #self.udpSock.bind(QHostAddress.AnyIPv4, self.XPPort, QUdpSocket.ShareAddress)
    #if not self.udpSock.joinMulticastGroup(self.XPAddr):
    #    logging.error("Failed to join multicast group")

@pyqtSlot(QAbstractSocket.SocketState)
def stateChangedSlot(self, state):
    """stateChangedSlot."""
    self.logger.debug("Sock new state: {}".format(state))

@pyqtSlot()
def connectedSlot(self):
    """connectedSlot."""
    self.logger.debug("udp connected: {}".format(self.udpSock.state()))

@pyqtSlot()
def udpData(self):
    """udpData."""
    print("inside class pyG5NetWorkManager(QObject): udpData())")
    while self.udpSock.hasPendingDatagrams():
        data = self.udpSock.receiveDatagram()
        print("inside class pyG5NetWorkManager(QObject): len(data), data= ", len(data.data()), " , ", data.data() )
        if (len(data.data()) < 5):
            return
        data_dict = pickle.loads(data.data())
        # if data_dict has entries then emit
        print("Received data_dict= ", data_dict )   
        for k, v in data_dict.items():
            print(k, v)
        print("Received len(data_dict), len(data_dict.keys(), data_dict.keys()=", len(data_dict), len(data_dict.keys()), data_dict.keys() )
        print("data_dict=", data_dict["'roll'"])
        print("data_dict=", data_dict["'pitch'"])
        print("data_dict=", data_dict["'yaw'"])
        retvalues = {}
        datarefs = [
            # ( dataref, frequency, unit, description, num decimals to display in formatted output )
            (
                "sim/flightmodel/position/mag_psi",
                30,
                "°",
                "Magnetic heading of the aircraft",
                0,
                "_magHeading",
            ),
            (
                "sim/flightmodel/position/phi",
                30,
                "°",
                "Roll of the aircraft",
                0,
                "_rollAngle",
            ),
            (
                "sim/flightmodel/position/theta",
                30,
                "°",
                "Pitch of the aircraft",
                0,
                "_pitchAngle",
            ), 
            ]
        numvalues = 1 #test with rollAngle #int(len(values) / lenvalue)
        idx = 0
        value = 0
        for i in range(0, numvalues):
            #singledata = data[(5 + lenvalue * i) : (5 + lenvalue * (i + 1))]
            #(idx, value) = struct.unpack("<if", singledata)
            idx = 1
            value = '10.0' #data_dict["'roll'"]
            retvalues[idx] = (
                value,
                datarefs[idx][1],
                datarefs[idx][0],
                datarefs[idx][5],
                )
        self.drefUpdate.emit(retvalues)
        break
        #if "BECN" in str(datagram.data())[2:6]:
        #    self.xpInstance.emit(
        #        datagram.senderAddress(),
        #        int.from_bytes(bytes(datagram.data())[19:21], byteorder="little"),
        #    )
        #    self.udpSock.leaveMulticastGroup(self.XPAddr)
        #self.udpSock.close()

Display resolution and secondary display questions

Some questions:

  1. my display native resolution is 1024x600. The G5DualStacked does not really fill the whole display, only about 80-90% of the size, with unused space at the top and right. I discovered in pyG5View.py the lines 35ff:
g5Width = 480
g5CenterX = g5Width / 2
g5Height = 360
g5CenterY = g5Height / 2

are these intended to change the size of the G5 ?

  1. about the "pyG5SecondaryWidget": will this show up on the secondary display if there is a second one connected to the raspi ?

  2. I would like to add a tachometer for the engine RPM on the secondary display. Any hints where in the source code to start with ?

New release 0.0.3 on pypi?

I've been using pyG5 for a while, and I noticed some months back that it didn't work with the latest python 3.10 version of python, because of changes in Python not interacting well with pyqt5 (something about auto conversion between float and int, that affected many other pyqt5 projects, not just yours). I cloned your repo and discovered the latest code works under python 3.10, so thank you very much for your recent work that fixed that!

However, there hasn't been a new release since 0.0.2 in May of 2022. Any chance you'll do a new release soon and push 0.0.3 to pypi? If you do that, then I can simply pip install pyg5 to get a version that works for me. Otherwise I need to clone your repo and do pip install --editable .

Thanks for creating this cool project in the first place, and making it open source!

Hi, got latest pyG5 working with PX4 pixhawk mavlink and pyEfis

Hi:
I was able to modify your latest pyG5 distro code to work with PX4 pixhawk mavlink over radios or ip or sitl, I have attached pic and vid , will get code up on github. I reuse youre repo and code.
I modified in my repo pyG5Network.py
I can now send messages to pyG5 and pyEfis from mavlink PX4 autopilot or gazebo sitl for virtual testing wo hardware.
not sure u can see these files I attached below: an mp4 and png
Finest Regards, -Jerry Fat
https://github.com/blauret/pyG5/assets/8506407/099c6912-0b37-410b-9eb5-f095080e8f71

Screenshot from 2023-11-30 17-57-49

QPoint(): too many arguments error at program runtime

first of all thank you for PyG5
I want to use it in a project I made, but I could not run PyG5.
so ı clone this repo but ı am taking thats error
pyG5\pyG5View.py", line 753, in paintEvent self.qp.drawText(QPoint(30 + 3, height + 2), str(int(pitch))) #, str(int(pitch)) TypeError: arguments did not match any overloaded call: QPoint(): too many arguments QPoint(int, int): argument 2 has unexpected type 'float' QPoint(QPoint): argument 1 has unexpected type 'int'
I get an error and I cant found how to fix this error
My pyqt5 versions are as follows
PyQt5 5.15.7
PyQt5-Qt5 5.15.2
PyQt5-sip 12.11.0
pyqt5ac 1.2.1
Thank you

sudo pip3 install pyside6 does not work

Using Raspberry Pi 4, Raspberry Pi Imager and Raspberry Pi OS (32-bit) (based on Debian Bookworm) from 2024-03-15,
python3 -m venv myenv && source myenv/bin/activate && pip3 install pyside6 does not work , nor does:
apt-cache search PySide6 does not find anything to install

now I am trying to build QT6 on Raspberry Pi OS and pyside6 for Python by myself on the Pi4

Any other ideas so far ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.