bluerobotics / ping-arduino

Arduino library to interact with the Ping sonar using the Ping Protocol messages.
6 stars 16 forks source link

CI has broken some names #24

Closed jerabaul29 closed 2 years ago

jerabaul29 commented 3 years ago

I am trying to use this code in a platformio project but I get many compilation errors.

git submodule add git@github.com:bluerobotics/ping-arduino.git

~/Desktop/Git/Vibration_Logger/material_Jean/Due_SD_high_frequency_logger/lib [master|…1]> ls
Adafruit_GPS  BlueOcean_TSYS01  DueFlashStorage  ping-arduino  README  SdFat-beta
~/Desktop/Git/Vibration_Logger/material_Jean/Due_SD_high_frequency_logger/lib [master|…1]> ls ping-arduino/
doc  examples  library.properties  README.md  src

But I get many compilation errors:

Compiling .pio/build/due/lib4e2/ping-arduino/ping1d.cpp.o
lib/ping-arduino/src/ping1d.cpp: In member function 'void Ping1D::handleMessage(PingMessage*)':
lib/ping-arduino/src/ping1d.cpp:104:31: error: 'Device_information' is not a member of 'Ping1DNamespace'
         case Ping1DNamespace::Device_information:
                               ^~~~~~~~~~~~~~~~~~
lib/ping-arduino/src/ping1d.cpp:106:13: error: 'ping_msg_ping1D_device_information' was not declared in this scope
             ping_msg_ping1D_device_information m(*pmsg);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/ping-arduino/src/ping1d.cpp:106:13: note: suggested alternative: 'ping_msg_ping1D_pulse_duration'
             ping_msg_ping1D_device_information m(*pmsg);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             ping_msg_ping1D_pulse_duration
lib/ping-arduino/src/ping1d.cpp:107:28: error: 'm' was not declared in this scope
             _device_type = m.device_type();
                            ^
lib/ping-arduino/src/ping1d.cpp:107:28: note: suggested alternative: 'tm'
             _device_type = m.device_type();
                            ^
                            tm
lib/ping-arduino/src/ping1d.cpp:121:36: error: 'class ping_msg_ping1D_distance' has no member named 'transmit_duration'; did you mean 'pulse_duration'?
             _transmit_duration = m.transmit_duration();
                                    ^~~~~~~~~~~~~~~~~
                                    pulse_duration
lib/ping-arduino/src/ping1d.cpp:125:31: error: 'class ping_msg_ping1D_distance' has no member named 'gain_setting'
Compiling .pio/build/due/FrameworkArduino/WMath.cpp.o
             _gain_setting = m.gain_setting();
                               ^~~~~~~~~~~~
lib/ping-arduino/src/ping1d.cpp:147:31: error: 'Gain_setting' is not a member of 'Ping1DNamespace'
         case Ping1DNamespace::Gain_setting:
                               ^~~~~~~~~~~~
lib/ping-arduino/src/ping1d.cpp:149:13: error: 'ping_msg_ping1D_gain_setting' was not declared in this scope
             ping_msg_ping1D_gain_setting m(*pmsg);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/ping-arduino/src/ping1d.cpp:149:13: note: suggested alternative: 'ping_msg_ping1D_gain_index'
             ping_msg_ping1D_gain_setting m(*pmsg);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
             ping_msg_ping1D_gain_index
lib/ping-arduino/src/ping1d.cpp:150:29: error: 'm' was not declared in this scope
             _gain_setting = m.gain_setting();
                             ^
Compiling .pio/build/due/FrameworkArduino/WString.cpp.o
lib/ping-arduino/src/ping1d.cpp:150:29: note: suggested alternative: 'tm'
             _gain_setting = m.gain_setting();
                             ^
                             tm
lib/ping-arduino/src/ping1d.cpp:161:31: error: 'class ping_msg_ping1D_general_info' has no member named 'gain_setting'
             _gain_setting = m.gain_setting();
                               ^~~~~~~~~~~~
lib/ping-arduino/src/ping1d.cpp:206:36: error: 'class ping_msg_ping1D_profile' has no member named 'transmit_duration'; did you mean 'pulse_duration'?
             _transmit_duration = m.transmit_duration();
                                    ^~~~~~~~~~~~~~~~~
                                    pulse_duration
lib/ping-arduino/src/ping1d.cpp:210:31: error: 'class ping_msg_ping1D_profile' has no member named 'gain_setting'
             _gain_setting = m.gain_setting();
                               ^~~~~~~~~~~~
lib/ping-arduino/src/ping1d.cpp:229:32: error: 'class ping_msg_ping1D_protocol_version' has no member named 'version_major'
             _version_major = m.version_major();
                                ^~~~~~~~~~~~~
lib/ping-arduino/src/ping1d.cpp:230:32: error: 'class ping_msg_ping1D_protocol_version' has no member named 'version_minor'
             _version_minor = m.version_minor();
                                ^~~~~~~~~~~~~
lib/ping-arduino/src/ping1d.cpp:231:32: error: 'class ping_msg_ping1D_protocol_version' has no member named 'version_patch'
             _version_patch = m.version_patch();
                                ^~~~~~~~~~~~~
lib/ping-arduino/src/ping1d.cpp:232:27: error: 'class ping_msg_ping1D_protocol_version' has no member named 'reserved'
             _reserved = m.reserved();
                           ^~~~~~~~
lib/ping-arduino/src/ping1d.cpp:251:31: error: 'Transmit_duration' is not a member of 'Ping1DNamespace'
         case Ping1DNamespace::Transmit_duration:
                               ^~~~~~~~~~~~~~~~~
lib/ping-arduino/src/ping1d.cpp:251:31: note: suggested alternative: 'Pulse_duration'
         case Ping1DNamespace::Transmit_duration:
                               ^~~~~~~~~~~~~~~~~
                               Pulse_duration
lib/ping-arduino/src/ping1d.cpp:253:13: error: 'ping_msg_ping1D_transmit_duration' was not declared in this scope
             ping_msg_ping1D_transmit_duration m(*pmsg);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/ping-arduino/src/ping1d.cpp:253:13: note: suggested alternative: 'ping_msg_ping1D_pulse_duration'
             ping_msg_ping1D_transmit_duration m(*pmsg);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             ping_msg_ping1D_pulse_duration
lib/ping-arduino/src/ping1d.cpp:254:34: error: 'm' was not declared in this scope
             _transmit_duration = m.transmit_duration();
                                  ^
lib/ping-arduino/src/ping1d.cpp:254:34: note: suggested alternative: 'tm'
             _transmit_duration = m.transmit_duration();
                                  ^
                                  tm
lib/ping-arduino/src/ping1d.cpp: In member function 'bool Ping1D::set_gain_setting(uint8_t, bool)':
lib/ping-arduino/src/ping1d.cpp:312:5: error: 'ping_msg_ping1D_set_gain_setting' was not declared in this scope
     ping_msg_ping1D_set_gain_setting m;
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Compiling .pio/build/due/FrameworkArduino/abi.cpp.o
lib/ping-arduino/src/ping1d.cpp:312:5: note: suggested alternative: 'ping_msg_ping1D_set_gain_index'
     ping_msg_ping1D_set_gain_setting m;
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     ping_msg_ping1D_set_gain_index
lib/ping-arduino/src/ping1d.cpp:313:5: error: 'm' was not declared in this scope
     m.set_gain_setting(gain_setting);
     ^
lib/ping-arduino/src/ping1d.cpp:313:5: note: suggested alternative: 'tm'
     m.set_gain_setting(gain_setting);
     ^
     tm
lib/ping-arduino/src/ping1d.cpp:316:35: error: 'Gain_setting' is not a member of 'Ping1DNamespace'
     if (!request(Ping1DNamespace::Gain_setting)) {
                                   ^~~~~~~~~~~~
Compiling .pio/build/due/FrameworkArduino/avr/dtostrf.c.o
Compiling .pio/build/due/FrameworkArduino/cortex_handlers.c.o
Compiling .pio/build/due/FrameworkArduino/hooks.c.o
*** [.pio/build/due/lib4e2/ping-arduino/ping1d.cpp.o] Error 1

Any idea what the problem is? After inspecting the code, it does look like the code is broken. Should I use a specific commit or something like that?

jerabaul29 commented 3 years ago

If anyone has the same problem: for now, I just downgraded to the commit b010e7f01cdb56b1047ba073862175a922dff08d corresponding to the release 0.0.2. This allows to compile successfully - though I would of course prefer to use master and that it would work :) .

patrickelectric commented 3 years ago

Thanks @jerabaul29, it may be a problem in our master branch, we are going to investigate, thanks!

jerabaul29 commented 3 years ago

:)

jerabaul29 commented 3 years ago

PS: if there was a possibility that you could provide a version of the software that does all memory allocation statically at the creation of the interface class instance that would be great :) .

Being curious: do you know of anybody else having had similar problems before?

patrickelectric commented 3 years ago
  • I added to my project with:

We only support for now Arduino package manager, please install the library with it, the instructions are here: https://github.com/bluerobotics/ping-arduino#arduino-library-installation

I have just installed and it's working without problems.

jerabaul29 commented 3 years ago

Ok. I am able to install, just not with the latest commit: I checked out the same commit version that was used for the Arduino release. But I wonder if this means that some fixes etc that have been applied since then are not included in the code that is used then.

senceryazici commented 3 years ago

Hi @patrickelectric,

I'm getting errors building the project, there are some name changes after the commit 64bdd052b02759ae5a39c505771f97103490a0df,

For example, b15875b1254e5a4b5c7371dc1d1e226c20c00aba this commit renames some functions in some source and header files, but does not rename it in pingmessage_ping1D.h autogenerated file. There might be a problem with the autogeneration script.

As an example, in the function set_gain_setting

ping_msg_ping1D_set_gain_setting type is used, but the project does not even contain any file that contains this keyword. In the pingmessage_ping1D.h file, L525, the name is ping_msg_ping1D_set_gain_index, which is unchanged.

The problem is not due to PlatformIO, also the Arduino IDE fails to build, also as seen the CI tool fails after that commit which the renames occured.

I solved the problem by correctly renaming the failing variables, but I cannot open a pull request since this edit will not fix your autogeneration script and will fail on the next update.

Renaming is always a trouble isn't it ? :)

Thanks.