Writting your avionics code with the help of chatGPT

The Rocketry Forum

Help Support The Rocketry Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
It appears to be changing the world from what I see and hear. I've never used it, but I keep hearing about it being used for job interviewing, schooling & education, coding & report writing.

TP

I think it's talked about more than actually used. This is all in the hype part of the hype cycle. There are plenty of use cases for the transformation model. And some not so much.

But right now, copilot, etc are no much better than stack overflow and often as misleading. The LLMs have no ability to reason, so they can't make any judgement calls on what they actually produce.

Then again critical thinking seems to be in short supply these days.

P.s. when u see chatgpt, etc rejectimg your prompt...that's a bit of nlp/llm and embedded databases figuring out what you are asking the comparing it against set of off limits topics.

Certainly an interesting, and not so interesting, area. Do wish I kept up with my mat knowledge... Alas, when u don't use something it goes to waste
 
When I asked it to write me a Arduino based Morse Code "DeCoder" it kept giving me More Code "EnCoders" that took text and put dots and dashes on the screen or toggle an I/O pin to key a radio. I searched the code on google and it was just using other peoples code.

I told it the problem, you are giving me EnCoders, not A decoder. I need a decoder that takes audio from a radio and displays text from it. It thought for a time and could not do it. Because there is not one on the internet yet for it to copy was my best guess.
 
When I asked it to write me a Arduino based Morse Code "DeCoder" it kept giving me More Code "EnCoders" that took text and put dots and dashes on the screen or toggle an I/O pin to key a radio. I searched the code on google and it was just using other peoples code.

I told it the problem, you are giving me EnCoders, not A decoder. I need a decoder that takes audio from a radio and displays text from it. It thought for a time and could not do it. Because there is not one on the internet yet for it to copy was my best guess.
Yes.
 

bdureau,​

I wish you had shown more of the AI generated code or included more information about your operational specifications. What I do see, promotes more questions about the AI generated code's throughput efficiency. How fast did you request the BMP280 to be sampled? What data is sent to the Sd card?
 
I could be convinced about coding, but I’m very skeptical about using various AI for creative work and work involving judgement. As an example, my daughter has a gig right now writing material science articles for a former sailing buddy. Her buddy came to her after ChatGPT very confidently recommended aluminum wiring in oats for the weight savings. No mention of the fire hazard, of course.
 
[Ignoring the copyright issues for now]

I have used ChatGPT to get specific code examples Ex: "Can you generate C code for the Python Huber Regressor...?" It does indeed give me code - but that I then have to test against the python version across some quantity of datasets. I've also asked it questions about topics like "parquet file format" and you can actually learn enough with code to understand it... (!). What is really nice is subsequent questions can build on what you learned from previous answers. [if it referred to a "parquet header", then your next question can be "what is the binary format of the Parquet header?" !!!]

But - I once asked it to give me code in C to give the time since last boot for a Windows system. It gave it to me - but was wrong the first three times.... (You can actually get it to admit it made a mistake and update the answer - but you had to be able to recognize that it was a mistake...) In this particular case, it seemed to have a problem with units (microseconds vs seconds) as well as regular math... it had a variable, assigned it to another variable. subtracted the two variables (now always equals zero) - and thought that was the time since boot...

But in keeping with this thread, i also tried to ask it for Raven software right now and it is clear that it doesn't understand what a Raven is (I had follow up questions for it that made it obvious)... but this was my attempt...

1704334189608.png

But was able to ask for code in C for the conversion (I didn't sanity check it though). [The code sample included a main as well so would be fully functional.]

1704334310781.png
 
[Ignoring the copyright issues for now]

I have used ChatGPT to get specific code examples Ex: "Can you generate C code for the Python Huber Regressor...?" It does indeed give me code - but that I then have to test against the python version across some quantity of datasets. I've also asked it questions about topics like "parquet file format" and you can actually learn enough with code to understand it... (!). What is really nice is subsequent questions can build on what you learned from previous answers. [if it referred to a "parquet header", then your next question can be "what is the binary format of the Parquet header?" !!!]

But - I once asked it to give me code in C to give the time since last boot for a Windows system. It gave it to me - but was wrong the first three times.... (You can actually get it to admit it made a mistake and update the answer - but you had to be able to recognize that it was a mistake...) In this particular case, it seemed to have a problem with units (microseconds vs seconds) as well as regular math... it had a variable, assigned it to another variable. subtracted the two variables (now always equals zero) - and thought that was the time since boot...

But in keeping with this thread, i also tried to ask it for Raven software right now and it is clear that it doesn't understand what a Raven is (I had follow up questions for it that made it obvious)... but this was my attempt...

View attachment 622762

But was able to ask for code in C for the conversion (I didn't sanity check it though). [The code sample included a main as well so would be fully functional.] It seems to me that ChatGPT is more effective for writing some simple texts, but even in this case, a good result is not guaranteed. It will take some time before AI becomes more advanced for such complex tasks as generating correct code. I tried to use this software to write a term paper on medicine, but I was not happy with the result. Instead, I decided to buy nursing papers cheap online to get the original article. It seems to me that quite a bit of time must pass before such programs can replace a person.

View attachment 622763
It seems to me that ChatGPT is more effective for writing some simple texts, but even in this case, a good result is not guaranteed.
 
I gave GPT-4 a test at writing avionics code for a 500Hz flight computer. The system would use an RP2040 processor, an ICM-20649 IMU, and a BMP280 altimeter as data sensors. The data would be formatted as a CSV data string and stored to an external SD flash card. My early description attempts returned code that was only rudimentary and non-functional. I find that AI prefers the simplest approach for sensor communications, I2C over SPI or QSPI. I'll keep trying to refine my code requirement description. The baseline for this test is code that I wrote and tested at 860Hz. I'm giving AI some slack requesting only 500Hz, but I don't expect any great break throughs in code development from what I have seen.
 
Back
Top