Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: Cannot initialize DBUS obdsim generator

  1. #1
    Newbie
    Join Date
    Aug 2007
    Posts
    17

    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. #2
    SuperMod - OBDII GPS Logger forum
    Auto Apps:loading...

    Join Date
    Mar 2009
    Location
    Los Angeles
    Posts
    929
    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

  3. #3
    Newbie
    Join Date
    Aug 2007
    Posts
    17
    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...

  4. #4
    SuperMod - OBDII GPS Logger forum
    Auto Apps:loading...

    Join Date
    Mar 2009
    Location
    Los Angeles
    Posts
    929
    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

  5. #5
    Newbie
    Join Date
    Aug 2007
    Posts
    17
    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

  6. #6
    SuperMod - OBDII GPS Logger forum
    Auto Apps:loading...

    Join Date
    Mar 2009
    Location
    Los Angeles
    Posts
    929
    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

  7. #7
    Newbie
    Join Date
    Aug 2007
    Posts
    17
    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

  8. #8
    SuperMod - OBDII GPS Logger forum
    Auto Apps:loading...

    Join Date
    Mar 2009
    Location
    Los Angeles
    Posts
    929
    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

  9. #9
    Newbie
    Join Date
    Aug 2007
    Posts
    17
    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

  10. #10
    SuperMod - OBDII GPS Logger forum
    Auto Apps:loading...

    Join Date
    Mar 2009
    Location
    Los Angeles
    Posts
    929
    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

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •