Firmware / VSC Problem

I´ve tryed to modify the aktually Firmware 1.0.0.0. When I open the Source File and show the main.cpp - he will show me 7 Problems :slight_smile:

include error detected. Update your includePath. Wavy lines are deactivated for this translation unit (C: \ Users \ Reinhardt \ Desktop \ leo_firmware-1.0.0 \ main.cpp).

Wavy Lines :

#include <leo_firmware/config.h>

#include <leo_firmware/diff_drive_controller.h>

#include <leo_firmware/logging.h>

#include <leo_firmware/sensors/gps.h>

#include <leo_firmware/sensors/imu.h>

#include <leo_firmware/utils.h>

and

“c: \ Users \ Reinhardt \ Desktop \ leo_firmware-1.0.0”,
“severity”: 4,
“message”: “” C: \ Users \ Reinhardt \. vscode \ extensions \ husarion.husarion-1.5.30 \ sdk \ ports \ stm32 \ src \ “was not found.” ,

–> same with hPeriph, hUSB,…

With the last Firmware everything was fine. WHAT IS WRONG ??? I´ve deinstalled everything and make a complete new Installation with all the nedded Extensions. But same Failure.

How to get the newest Cmake Version in VSC ? 0.0.17 is the latest ???

@Blazej_Sowa can you help here?

This is an issue with the Husarion extension adding wrong include paths to the VSC config and not adding the paths specified in the CMakeLists file. The project should build just fine, but if you find the errors annoying, you can fix it by modifying the .vscode/c_cpp_properties.json file inside your project. Search for the DefaultIncludePath list, remove unresolvable paths and add this path: "${workspaceFolder}/include" to the list.

1 Like

Do you have an example of this? There are several “DefaultIncludePath” lists. I tried to ignore that, but it doesn’t work. in the main.cpp he also finds nothing.

#include <leo_firmware / config.h>
#include <leo_firmware / diff_drive_controller.h>
#include <leo_firmware / logging.h>
#include <leo_firmware / sensors / gps.h>
#include <leo_firmware / sensors / imu.h>
#include <leo_firmware / utils.h>

Can you post your c_cpp_propertis?

I have to include the Relays Topics with switched Parameters

–> oid relay1Callback(const std_msgs::Bool& msg)

{

if (msg.data==true) hSens1.pin1.write(0);

else hSens1.pin1.write(1);;

}

void relay2Callback(const std_msgs::Bool& msg)

{

if (msg.data==true) hSens1.pin2.write(0);

else hSens1.pin2.write(1);;

}

void relay3Callback(const std_msgs::Bool& msg)

{

if (msg.data==true) hSens1.pin3.write(0);

else hSens1.pin3.write(1);;

}

void relay4Callback(const std_msgs::Bool& msg)

{

if (msg.data==true) hSens1.pin4.write(0);

else hSens1.pin4.write(1);;

Same like the sample but 0/1 changed in case of optocoupler .

Which version do you work with. In the current version, some hxxxxx.h are no longer there or have been renamed.

Post-folder-open TypeError: Cannot read property ‘length’ of undefined {“folder”: {“uri”: {"$ mid": 1, “fsPath”: "c: \ Users \ Reinhardt \ Desktop \ \ leo_firmware-1.0.0 “,” _sep “: 1,” external “:” file: ///c%3A/Users/Reinhardt/Desktop/leo_firmware-1.0.0 “,” path “:” / c: / Users / Reinhardt / Desktop / leo_firmware-1.0.0 “,” scheme “:” file “},” name “:” leo_firmware-1.0.0 “,” index ": 0}}

Hmmm. Why do I always notice this?

Here is my c_cpp_properties.json file:

{
    "env": {
        "DefaultIncludePath": [
            "/home/blazej/.vscode/extensions/husarion.husarion-1.5.30/sdk/ports/stm32/include",
            "/home/blazej/.vscode/extensions/husarion.husarion-1.5.30/sdk/include",
            "/home/blazej/.vscode/extensions/husarion.husarion-1.5.30/sdk/include/hCloudClient",
            "/home/blazej/.vscode/extensions/husarion.husarion-1.5.30/sdk/include/hROS",
            "/usr/include",
            "${workspaceFolder}/include"
        ]
    },
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${DefaultIncludePath}"
            ],
            "defines": [
                "BOARD_TYPE=CORE2",
                "PORT=STM32",
                "BOARD_VERSION=1.0.0"
            ],
            "intelliSenseMode": "gcc-x64",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "compilerPath": "arm-none-eabi-gcc.exe"
        },
        {
            "name": "Linux",
            "includePath": [
                "${DefaultIncludePath}"
            ],
            "defines": [
                "BOARD_TYPE=CORE2",
                "PORT=STM32",
                "BOARD_VERSION=1.0.0"
            ],
            "intelliSenseMode": "gcc-x64",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "compilerPath": "/usr/bin/arm-none-eabi-gcc"
        },
        {
            "name": "Mac",
            "includePath": [
                "${DefaultIncludePath}"
            ],
            "defines": [
                "BOARD_TYPE=CORE2",
                "PORT=STM32",
                "BOARD_VERSION=1.0.0"
            ],
            "macFrameworkPath": [
                "/System/Library/Frameworks",
                "/Library/Frameworks"
            ],
            "intelliSenseMode": "clang-x64",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "compilerPath": "/usr/bin/arm-none-eabi-gcc"
        }
    ],
    "version": 4
}

So it worked out well. However, there is a bug in utils.h.

‘to_string’ is not a member of ‘std’

“” std “” has no member “” to_string “”.

Line 59
(std :: string param_prefix = “core2 / servo” + std :: to_string (num_) + “/”:wink:

comparison between signed and unsigned integer expressions [-Wsign-compare]

Maybe a Compiler Bug in Case of C++11

Apparently, this is a bug in the toolchain libraries shipped with the Husarion extension on Windows. I work primarily on Linux, so I didn’t have that problem. Thanks for noticing it.

I modified the code to not use the to_string() function and it successfully compiled on Windows. I made a commit on the devel branch. Please try this version and let me know if it works.

1 Like

This Version works fine. Everything OK without Errors. Thank you