Announcement

Collapse
No announcement yet.

Cannot initialize DBUS obdsim generator

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cannot initialize DBUS obdsim generator

    I compiled the latest SVN copy using the OBD_ENABLE_DBUS flag, started obdsim with the following parameters:

    Code:
    $ obdsim -s bitofcoast.db -g DBus
    And I received the following output:

    Code:
    DBus Config. interface=
    DBus Config. interface=
    Couldn't find any mappings in DBus config file, cannot continue
    Couldn't initialise data generator "DBus"
    I don't have the OBD unit plugged into the car, just the PC. I am using a custom Ubuntu 9.04 i386 build with a USB ELM327 OBD module connected on /dev/ttyUSB0 and a USB GPS receiver connected on /dev/ttyUSB1

    I am basically trying to build a custom realtime data visualizer using DBUS signals, so I am trying to receive random DBUS messages first before I move on to coding the UI.

    It looks like I need to create/modify a DBus configuration file, but I'm not sure where it is located or under what format I should write it in. Any help would be appreciated.

    Thanks for such a cool contribution, Gary! This will finally allow me to build my dream carpc.

  • #2
    That seed [bitofcoast.db] is most useful with the "Logger" generator. I also suggest using a more up to date logfile [at least while trying out sim, using "Logger" just to see *something* work], that's the first one I ever published.

    A sample config for the dbus generator is in src/sim/generators/dbus/dbustest.simconf

    I am trying to receive random DBUS messages
    OBDSim doesn't generate messages, it only listens for signals. If you are writing something that listens for dbus signals, obdgpslogger signals stuff.

    Gary (-;
    OBDGPSLogger, for logging OBDII and/or GPS data
    OBDSim, an OBDII/ELM327 software simulator
    mp3car forums: obdgpslogger, obdsim

    Comment


    • #3
      OK, I may be doing something wrong here...

      I entered the following command:

      Code:
      obdsim -s dbustest.simconf -g DBus -o
      and I got some encouraging "DBus Config" output. But right after the pty slave name was defined (/dev/pts/1 in case it makes any difference), the following message came up:

      Code:
      First argument isn't of type int
      Everything looked pretty much OK after that, except that every value came out as 0.000000 (temp, rpm, vss, maf, and throttlepos), and dbus-monitor never triggered a signal.

      Am I missing something here? Thanks in advance...

      Comment


      • #4
        OK, the way that obdsim's dbus plugin works is that it listens for signals on the path/member/interface 3-tuple. The source is in src/sim/generators/dbus/gen_dbus.c and should be pretty palatable. From the top:

        Code:
        /// Mappings and most-recently-seen values are stored in this list
        /** DBus messages are expected to come as two numbers; an integer then
           an integer or floating point number. The first is mapped onto a PID
           using this table. The second is the actual value to be passed.
        */
        So, what happens is signals are INT32 then INT32 or DOUBLE. The first INT32 is mapped to a PID using "map" entries in the config file. The second is the value. The actual handling is done in dbus_simgen_msgfilter, lines 287 to 317.

        The signals are processed as they're seen, and the most recently value is always remembered. When the OBDII tool talking to OBDSIM requests a value, it responds with the most recently seen version [line 261].

        The error you saw, "First argument isn't of type int", is because it read the signal you configured, but the first value in the signal was a type other than DBUS_TYPE_INT32

        Hope that's helpful,
        Gary (-;
        OBDGPSLogger, for logging OBDII and/or GPS data
        OBDSim, an OBDII/ELM327 software simulator
        mp3car forums: obdgpslogger, obdsim

        Comment


        • #5
          Thanks for the extra information. I guess I need to look more into C programming.

          I tried figuring out how to send tuples through the command line, but I wasn't able to get it to work. My coding background deals with ActionScript, which I guess is similar to C in a few respects. Tuples look a lot like AS objects, which are sent in key/value pairs like so:

          Code:
          var tuple:Object = {key1:'key', value1:'value'};
          sendDbusMessage(tuple);
          Am I on the right track here? A sample command would be really helpful! Thanks again

          Comment


          • #6
            If you're trying to do stuff using actionscript, sorry, I've never used it at all.

            To signal tuples using C, check src/logger/obddbus.c. That code sends UINT32, DOUBLE, STRING, STRING. So change it so it sends INT32, DOUBLE and you'll be set.

            Gary (-;
            OBDGPSLogger, for logging OBDII and/or GPS data
            OBDSim, an OBDII/ELM327 software simulator
            mp3car forums: obdgpslogger, obdsim

            Comment


            • #7
              Yeah I'm trying to get the UI done in Adobe AIR. But I meant that I'd like to see a CLI sample... Something like:

              Code:
              $ obdsim -s dbustest.simconf -g DBus -o
              Where should the tuple be placed above, and in what format? Basically I want the AIR app to send shell commands behind the scenes. I could send something like the code above, or using dbus-send, whichever is best. TIA

              Comment


              • #8
                Can you post your .simconf file?

                Gary (-;
                OBDGPSLogger, for logging OBDII and/or GPS data
                OBDSim, an OBDII/ELM327 software simulator
                mp3car forums: obdgpslogger, obdsim

                Comment


                • #9
                  Sure. I haven't modified it at all however:

                  # obdsim dbus plugin sample config file
                  #
                  # This sample works with fbd based signals from Fusion Brain devices
                  # Originally written by cgalpin on the mp3car forums
                  #
                  # fbd is a Linux daemon that listens talks to fusion brain devices. It's
                  # available here:
                  # http://www.mp3car.com/vbulletin/fusi...ram-linux.html
                  #
                  # We specifically listen to only one member from one path from
                  # one interface

                  # The message for the member-path-interface 3-tuple must come in as two
                  # numbers. The first is mapped to a PID using this file. The second
                  # is a real or integer that is the actual value.

                  # bus can be "session" or "system"
                  bus=system

                  interface=org.openice.fbd.fusionbrain

                  path=/org/openice/fbd

                  member=AnalogValueChanged

                  # Some sample mappings.
                  # Each mapping is of the form:
                  # map {decimal FB analog input} -> {hex PID}
                  # Where 0 >= {analog input} < 13
                  # and PID is the OBDII service command

                  # Map engine temperature
                  map 1 -> 0x05

                  # Map airflow mass
                  map 2 -> 0x10

                  # Map rpm
                  map 3 -> 0x0C

                  # Map vss
                  map 11 -> 0x0D

                  # Map throttlepos
                  map 12 -> 0x11

                  Comment


                  • #10
                    perhaps this will work:
                    Code:
                    dbus-send --system \
                     --dest=org.openice.fbd.fusionbrain \
                     --type=signal \
                     /org/openice/fbd \
                     AnalogValueChanged \
                     int32:11 \
                     int32:2600
                    I haven't actually tried this, mind. From the config above, it should tell obdsim that the rpms are now 2600.

                    Gary (-;
                    OBDGPSLogger, for logging OBDII and/or GPS data
                    OBDSim, an OBDII/ELM327 software simulator
                    mp3car forums: obdgpslogger, obdsim

                    Comment


                    • #11
                      The above command didn't seem to work, even after I fixed the syntax error to the following:

                      Code:
                      dbus-send --system \
                       --dest=org.openice.fbd.fusionbrain \
                       --type=signal \
                       /org/openice/fbd \
                       org.openice.fbd.fusionbrain.AnalogValueChanged \
                       int32:11 \
                       int32:2600
                      I opened up qdbusviewer in my desktop kde installation, downloaded/installed the latest SVN, and opened up obdsim prior to using the dbus-send command above, but nothing ever came up.

                      I'm looking for a way to receive a dbus signal from obdgpslogger every time it registers a new entry into the log so that I can display it on screen, so the above command will tunnel it through obdsim and end up in obdgpslogger, correct?

                      Thank you for your patience, Gary! I feel like I'm getting real close here.

                      Comment


                      • #12
                        I'm looking for a way to receive a dbus signal from obdgpslogger every time it registers a new entry into the log so that I can display it on screen
                        OK, I'm confused; could you exactly explain your situation? Are you in a car with an OBDII device, using obdgpslogger to read it? And then you want obdgpslogger to signal on dbus whenever it sees a new value?

                        If so... you don't want to use OBDSim for that; obdgpslogger already does it, all on its own. Check obddbus.c for the exact interface/path/member and the actual message

                        Gary (-;
                        OBDGPSLogger, for logging OBDII and/or GPS data
                        OBDSim, an OBDII/ELM327 software simulator
                        mp3car forums: obdgpslogger, obdsim

                        Comment


                        • #13
                          Originally posted by chunkyks View Post
                          OK, I'm confused; could you exactly explain your situation? Are you in a car with an OBDII device, using obdgpslogger to read it? And then you want obdgpslogger to signal on dbus whenever it sees a new value?
                          I am building a GUI that will be able to send/receive DBus messages to different areas of the OS. One of the areas deals with reading the OBD information and displaying it on screen. I think that obdgpslogger would help me out in achieving this really well.

                          If so... you don't want to use OBDSim for that; obdgpslogger already does it, all on its own.
                          The only reason why I want obdsim to work right now is because the pc isn't hooked up to the car yet, so I would like to simulate some DBus data for obdgpslogger to consume and then throw a DBus signal that my GUI can pick up.

                          Hope this makes more sense.

                          Comment


                          • #14
                            Ooooooooo

                            In that case, just use "obdsim -g Random -o"

                            Assuming obdgpslogger was build with dbus enabled, that should be all you need to actually generate dbus signals from obdgpslogger. If all you want to see it *something* output from obdgpslogger, then that should be sufficient

                            Gary (-;
                            OBDGPSLogger, for logging OBDII and/or GPS data
                            OBDSim, an OBDII/ELM327 software simulator
                            mp3car forums: obdgpslogger, obdsim

                            Comment


                            • #15
                              Or, if you want to see some more realistic figures, download http://icculus.org/obdgpslogger/down-to-vista.db and use
                              Code:
                              obdsim -g Logger -s down-to-vista.db
                              You can also use obdgui to connect to the pty that obdsim announces, and verify that your dbus signal reader is reading the right thing by checking that obdgui and your gui say the same thing.

                              Gary (-;
                              OBDGPSLogger, for logging OBDII and/or GPS data
                              OBDSim, an OBDII/ELM327 software simulator
                              mp3car forums: obdgpslogger, obdsim

                              Comment

                              Working...
                              X