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

Not an issue, a word of wonder! #259

Open
threepotMR2 opened this issue Jan 24, 2025 · 12 comments
Open

Not an issue, a word of wonder! #259

threepotMR2 opened this issue Jan 24, 2025 · 12 comments

Comments

@threepotMR2
Copy link

Just wow 👍 This is an amazing creation indeed. Whoever you are that built this, you put loads of work into it and I love it to bits.

It took a bit of tinkering to get off the ground, had to install some dependencies and then build it again as the prebuilt linux/ubuntu version had some QML / QT issues that was stopping the QML executor from working which after many hours figured out, but that is the real world right.

But over the last 2 days I have logged a complete VAG power train databus, worked out all the different repeat packets, then created either CanRawSender items for the static packets.... and more importantly for all the ones with sequential heartbeats wrote a wicked script for the QML Executor which now mimics things like the engine ECU, the cluster, the ABS.... then when I plug in the auto transmission module it thinks the whole car is running !!

I can't believe how good this software is, and its got almost zero publicity at all, although I have been looking for something like this for the last five years on an off.

It works perfectly with a CANable 2.0 adapter in linux Mint using the SocketCAN stuff. Plug it in and follow the getting started commands on here https://canable.io/getting-started.html

The instruction on your project front page for downloading the git and building etc were totally fantastic and perfect, this was all a very acheivable task for an pretty rubbish linus end user like me, and I think I will make a little youtube video about building my VAG powertrain simulator in CANdevStudio as I'm sure other people would love an intro to this sort of software tool.

Thank you for CANDevStudio, it totally rocks 🥇

@rkollataj
Copy link
Member

Thank you for your kind words and detailed feedback! It’s fantastic to hear that you’ve used the QML Executor and written scripts to mimic real VAG ECUs. A YouTube video about your project would be amazing - please feel free to share it once it’s ready.

Good luck with your work!

@LasseKofoed
Copy link

I just stumbled upon this project today after a long search, and I absolutely agree—this project gets far too little love and attention. It looks incredible, especially for simulating vehicle data. I was working with an Innomaker USB-CAN device while looking for a tool to simulate car values for another project I'm working on.

I’ve been trying to create a QML file, but my Windows build also crashes whenever I try to open the QMLExecutor—both with the provided samples and anything I attempt to create. I’m very interested in the QML files you’ve managed to create for simulating data, as well as how you solved the issue with the QMLExecutor crashing the application.

After much trial and error, and installing Qt 5.15.2 (instead of 5.12, which might be the root cause of my problem, but 5.12 isn’t available with the latest Qt installer) with the MSVC 2015, 2019 modules (both 32-bit and 64-bit), MiniGW 8.10 (32-bit and 64-bit), EWP 2015, 2019, and Boost, I’ve managed to get the following commands to work:

cmake .. -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 17 2022" -A x64  
cmake --build .  

These run without any errors. Even creating a package using:

cpack -G 7Z  
cmake . -DSTANDALONE=ON  
cpack -G 7Z  

produces the .exe and .dll files, but I keep running into this error:

This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: direct2d, minimal, offscreen, webgl, windows.
I also had to make some small changes to the CMakeLists.txt file to get it working, including adding:

set(CMAKE_PREFIX_PATH "C:/Qt/5.15.2/msvc2019_64")
and modifying:

set(QT_REQUIRED_VERSION "5.15.2")

I’m stuck on how to proceed and would greatly appreciate any help. I’m really excited about using this program to create some awesome CAN bus simulations.

P.S. In the project I found, there were two .dll files included that supported the Innomaker USB-CAN device:

qtcanarycanbus.dll
qtcanaryfdcanbus.dll
Please let me know where I can share these files to include them in the project.

@LasseKofoed
Copy link

I had a friend test the software, and he was able to open the QMLExecutor without it crashing on his machine. This led me to dig a bit deeper into the issue, and I found an error in the Windows Event Viewer:
Faulting module path: C:\WINDOWS\System32\DriverStore\FileRepository\u0390484.inf_amd64_630d985383d47087\B389503\atio6axx.dll

This pointed me towards the root of the problem. It turned out that I had never installed AMD’s ATI drivers on this machine and was using the default Windows drivers (dated 20/03/2023, version 31.0.12044.45004).

After updating to the official ATI drivers, I can now open the QMLExecutor without CANdevStudio crashing.

@threepotMR2 I’m still very interested in your QML files for emulating data, so please let me know if you’d be willing to share them!

@threepotMR2
Copy link
Author

threepotMR2 commented Jan 27, 2025

What vehicle are you trying to emulate?

It all starts with sniffing a car, do a nice log for 30 seconds.

The pull the log into a CSV, seperate it by source address.

Then you need to write some nice loops that generate the packets, some on later cars have sequential packet ID that loop from 00 to 0F etc, and some have CRC checksums etc.

Earlier cars before 2014 are normally easier.

I have just done PQ34 / 35 / 36 VAG and now working on MQB VAG. But keep in mind these things are many hours work, and it all depends what you are trying to emulate for what purpose - to emulate everything with lots of control and functionality is beyond my skills or time.

I'm not sure sharing my code is a bad idea, it will make me look very bad! I am not a programmer, my loops and use of arrays is all wrong, it is the worst example of how it shouldn't be done you can imagine 😆 But chatgpt is very good at writing QML etc, and the examples on this github show you some loops etc.

@LasseKofoed
Copy link

@threepotMR2
Thank you for your reply! I'm working on emulating some data from a MaxxECU for my 1988 Toyota Supra because I'm setting up a CAN bus display. I’d like to have some values that cycle slightly up and down so I can experiment with update rates and generally just have dynamic values to work with.

I have a DBC file loaded into CANdevStudio and can send values, but only as static ones so far. Here’s the protocol I’m using:
MaxxECU Default CAN Protocol v1.3

I’m really interested in seeing some example code from you! I also use ChatGPT a lot for this kind of work, but I sometimes hit roadblocks—like when it insists on using import QtQuick.Controls 2.0, which for some reason doesn’t work for me ("module missing"). Because of this, I haven’t yet figured out how to create settings within a QML file.

Right now, I’m trying to understand how to switch between big-endian and little-endian when sending a value.

Later, I’d also like to generate a CRC8 SAE J1850 value to work with my iBooster module.

If you’re not comfortable sharing your code publicly, feel free to share it directly with me. I really don’t think anyone would judge your code—it might not be perfect for everyone, but it would definitely serve as valuable inspiration for others!

@threepotMR2
Copy link
Author

threepotMR2 commented Jan 27, 2025

Those MAX ecu messages are easy to work with as they are all 8 bit or 16bit values.

E.g a full byte "FF" or just a nibble "-F"

The only funky one is "BO_ 1318 MSG_0x526: 8 MaxxECU" as one is just single bits 01010101011 etc for the status of things like clutch pedal switch etc.

Simulating all this is a bit pointless, you'd spend way more time trying to simulate the 20 can packets than actually just making your display work attached to the ECU itself.

But here is a bit of terrible code with a slider in the QMLexecutor GUI that changes a byte, and a incremental timer

import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.0
import QtQml 2.0

Item {
property var frameId6 : 0xAAA
property var payload6 : 00

    Timer {
    id: timer6
    interval: 100; running: false; repeat: true
    onTriggered: timer6Func()
}



function timer6Func() {
    //AAA 8 7F 00 00 00 00 00 60* 60* increments both by 10 same value

    let b6 = new ArrayBuffer(8);
    let view = new Uint8Array(b6)

    view[7] = payload6 & 0xff
    view[6] = payload6 & 0xff
    view[5] = 0x0
    view[4] = 0x0
    view[3] = 0x0
    view[2] = 0x0
    view[1] = 0x0
    view[0] = slider1.value & 0xff     //changing thing 0x7f                                             

    CANBusModel.sendFrame(frameId6, b6)
    payload6 = payload6 + 0x0F
    if (payload6 > 0xff) {
    payload6 = 0x00;
    }
}    

Item {

Slider {
  id: slider1
  from: 0
  value: 128
  to: 254
  stepSize: 2
  width:400
}   
Text {
    id: slider1text
    text: "Slider Value is " + slider1.value
    anchors.top: slider1.bottom
    anchors.horizontalCenter: slider1.bottom
}

}

Component.onCompleted: {
    LogWindow.setVisible(true)

    // Connect QML functions to CANBusModel signals
    CANBusModel.simulationStarted.connect(function(){ 
        LogWindow.appendPlainText("Simulation started");

        // Reset payload1 on each simulation start
        // payload2 is persistent across simulation start/end

        payload6 = 0
                                                 
        timer6.start()
                             
    })
    CANBusModel.simulationStopped.connect(function(){ 

        timer6.stop()

    })
}

}

@LasseKofoed
Copy link

Thank you for the example—it confirms that something is wrong on my computer, as I can’t load many of the modules you’re using. Here’s the error I get:

QML status: error - file:///W:/Z-Devices/Z-Displays/CanDevStudio files/threepotmr2sample.qml:5:1: module "QtQuick.Layouts" is not installed  
QML status: error - file:///W:/Z-Devices/Z-Displays/CanDevStudio files/threepotmr2sample.qml:4:1: module "QtQuick.Controls" is not installed  
QML status: error - file:///W:/Z-Devices/Z-Displays/CanDevStudio files/threepotmr2sample.qml:3:1: module "QtQuick.Window" is not installed  

It’s really helpful to see an example of something that works for others, though, so thank you!

Regarding my project, it’s not an off-the-shelf screen I’m working with—it’s a custom-developed touchscreen. If I were to connect it to the car, I’d be looking at spending the next 200 hours in the workshop with the engine running and cycling through all 8 gears in my ZF 8HP transmission. That’s why I’m focusing on building a simulation for now—it’ll save me a ton of time and fuel!

@threepotMR2
Copy link
Author

Get those QTQuick modules up and running! I had the same problem on my first installation but its all linux here so it'll be different for your MS Windoze !

But that example gives you the keys to changing bytes, there is a slider that changes one can message byte from 0x00 to 0xff

@LasseKofoed
Copy link

Thank you! I’ll have to give it another try.

Which version of Qt did you install?

@threepotMR2
Copy link
Author

I just run this at the command prompt and it gives me stuff!

sudo apt install qtbase5-dev libqt5serialbus5-dev libqt5svg5-dev qtdeclarative5-dev

which gives me:-

libqt5serialbus5-dev is already the newest version (5.12.8-0ubuntu1).
libqt5svg5-dev is already the newest version (5.12.8-0ubuntu1).
qtdeclarative5-dev is already the newest version (5.12.8-0ubuntu1).
qtbase5-dev is already the newest version (5.12.8+dfsg-0ubuntu2.1).

but those version may have no bearing on the Windows versions, I have no idea. I'm not really skilled in any of this.
I spent a whole night getting this QT stuff to work, and I ended up having to build/compile CANDevStudio from the source to get it to work.

@LasseKofoed
Copy link

@rkollataj

Hi Remigiusz Kołłątaj,

I’m getting close to pulling out what’s left of my hair! 😅 I simply can’t manage to build a Windows version that supports:

QtQuick.Layouts
QtQuick.Controls
QtQuick.Window
Would it be possible for you to create a new build that includes support for these modules and make it available for download?

Thank you so much in advance!

@threepotMR2
Copy link
Author

I've just installed this in windows for fun! 😆

I have the same problem.

But to reduce the problem, the QML script will run with only these imports:-

import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQml 2.0

Which leaves me with just QTQuick.Controls is not installed.
And if I put Qt5QuickControls.dll in the directory of CANDevStudio it doesn't help.

It needs building with that dll in place... but I'm not going down that rabbit hole just now as I've not got time to solve that right now.

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

3 participants