Giter VIP home page Giter VIP logo

libkovan's People

Contributors

bmcdorman avatar milch avatar navzam avatar zeltner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libkovan's Issues

[Critical BUG] Motor position counter keeps at zero in KISS IDE simulator, breaking several functions

I am using the KISS IDE 5.2.2 bundle (at least it claims itself to be 5.2.2 on the program title), on Windows 10. I am not sure what the libkovan version is, since the doxygen doc only gives a dummy value 1 (ah, another bug).

So here is the minimal code to reproduce it:

// Say, Um, motors.h?

int main(void)
{
    motor (0, 100);
    while (msleep (50), 1)
        printf ("POS\t%d\n", get_motor_position_counter(0));
    return 0;
}

On a robot it will be fine, but on a simulator it keeps giving zero. This breaks important functions include move_relative_position, and causes a lot of trouble since coders (especially Botball participants) will always need an actual bot to test the code.

Multithreading not supported

Yesterday at ECER 2013 our robot crashed multiple times. When I looked at our code today I couldn't find out what was wrong, so I decided to look at the libkovan code... Turns out, our problems were the threads we were using! I only looked through some of the files in the code, however, when looking at something like the following:

void Kovan::enqueueCommand(const Command &command, bool autoFlush)
 {
         m_queue.push_back(command);

         // FIXME: This logic needs to be improved eventually
         if(autoFlush) autoUpdate();
}

it became apparent that the library is not ready for multi-threading at all! When enqueuing from multiple threads, this becomes a classic read/write race-condition. You should look at this link, which explicitly states that STL containers are not guaranteed to be thread-safe and that it can cause problems when enqueuing from multiple threads and reading from another one (which is exactly what happens here).

Another example would be the following pattern, which is present throughout the kovan library:

Analog *Analog::instance()
{
    static Analog s_analog;
    return &s_analog;
}

Depending on the compiler used, this is also not thread-safe. The C++03 standard stays silent on this matter, so it's not safe to assume that the code the compiler produces will be thread-safe. However, if you are using C++11 then this becomes irrelevant (though I have no reason to believe that you are using C++11 from the code I have seen, because none of the newer features seem to be present).

Until this issue is resolved (and it is very likely going to be a time consuming process to convert the whole codebase to be thread-safe and to sort out all the multithreading bugs) I would advise you to deprecate the threading functions in the libkovan documentation as well as issue a warning not to use any hardware-related functionality from a thread other than the main-thread. The reason to this is that the current documentation mentions nothing of this, which can be irritating for people and lead them to believe that libkovan natively supports multithreading (like we believed... unfortunately, no bugs ever occured before the tournament).

NATIVE_RES not working

The file camera.h implies that there is the possibility to run the camera with it's native resolution but in camera_c.cpp in camera_open_at_res the NATIVE_RES set the resolution to 0x0 px.

mav function for motor control does not function properly

The mav function does not seem to work consistently, nor predictably, unlike similar functions such as mtp and mrp, which are similar, but target some specific position. The speed of the motor is not consistent throughout any single run.

bgr not working

bgr() in camera.hpp returns pic from camera-open, but picture is not updated!

kovan_module_p.cpp:83:2: error: '::close' has not been declared

I have tried many different solutions to no avail. I am running Arch Linux 64bit. All errors:
[ 1%] Building CXX object CMakeFiles/kovan.dir/src/kovan_module_p.cpp.o
/build/kiss-platform/common/libkovan/src/kovan_module_p.cpp: In member function 'void Private::KovanModule::close()':
/build/kiss-platform/common/libkovan/src/kovan_module_p.cpp:83:2: error: '::close' has not been declared
make[2]: *** [CMakeFiles/kovan.dir/src/kovan_module_p.cpp.o] Error 1
make[1]: *** [CMakeFiles/kovan.dir/all] Error 2
make: *** [all] Error 2
make for libkovan failed.

IF I edit kovan_module_p.hpp I get this:
In file included from /build/kiss-platform/common/libkovan/src/kovan_module_p.cpp:1:0:
/build/kiss-platform/common/libkovan/src/kovan_module_p.hpp:45:22: error: 'Command' was not declared in this scope
/build/kiss-platform/common/libkovan/src/kovan_module_p.hpp:45:29: error: template argument 1 is invalid
/build/kiss-platform/common/libkovan/src/kovan_module_p.hpp:45:29: error: template argument 2 is invalid
/build/kiss-platform/common/libkovan/src/kovan_module_p.hpp:45:44: error: invalid type in declaration before ';' token
/build/kiss-platform/common/libkovan/src/kovan_module_p.hpp:60:19: error: 'Command' does not name a type
/build/kiss-platform/common/libkovan/src/kovan_module_p.hpp:60:28: error: ISO C++ forbids declaration of 'command' with no type [-fpermissive]
/build/kiss-platform/common/libkovan/src/kovan_module_p.hpp:61:8: error: 'bool Private::KovanModule::send(const CommandVector&)' cannot be overloaded
/build/kiss-platform/common/libkovan/src/kovan_module_p.hpp:60:8: error: with 'bool Private::KovanModule::send(const int&)'
/build/kiss-platform/common/libkovan/src/kovan_module_p.hpp:63:13: error: 'State' has not been declared
/build/kiss-platform/common/libkovan/src/kovan_module_p.hpp:65:16: error: 'State' has not been declared
/build/kiss-platform/common/libkovan/src/kovan_module_p.hpp:66:27: error: 'State' does not name a type
/build/kiss-platform/common/libkovan/src/kovan_module_p.hpp:66:34: error: ISO C++ forbids declaration of 'state' with no type [-fpermissive]
/build/kiss-platform/common/libkovan/src/kovan_module_p.hpp:72:10: error: 'Packet' does not name a type
/build/kiss-platform/common/libkovan/src/kovan_module_p.cpp: In member function 'void Private::KovanModule::close()':
/build/kiss-platform/common/libkovan/src/kovan_module_p.cpp:83:2: error: '::close' has not been declared
/build/kiss-platform/common/libkovan/src/kovan_module_p.cpp: At global scope:
/build/kiss-platform/common/libkovan/src/kovan_module_p.cpp:99:30: error: 'Command' does not name a type
/build/kiss-platform/common/libkovan/src/kovan_module_p.cpp:99:39: error: ISO C++ forbids declaration of 'command' with no type [-fpermissive]
/build/kiss-platform/common/libkovan/src/kovan_module_p.cpp: In member function 'bool Private::KovanModule::send(const int&)':
/build/kiss-platform/common/libkovan/src/kovan_module_p.cpp:101:38: error: expression list treated as compound expression in functional cast [-fpermissive]
/build/kiss-platform/common/libkovan/src/kovan_module_p.cpp:101:38: warning: left operand of comma operator has no effect [-Wunused-value]
/build/kiss-platform/common/libkovan/src/kovan_module_p.cpp: At global scope:
/build/kiss-platform/common/libkovan/src/kovan_module_p.cpp:104:6: error: redefinition of 'bool Private::KovanModule::send(const CommandVector&)'
/build/kiss-platform/common/libkovan/src/kovan_module_p.cpp:99:6: error: 'bool Private::KovanModule::send(const int&)' previously defined here
/build/kiss-platform/common/libkovan/src/kovan_module_p.cpp:122:24: error: 'bool Private::KovanModule::recv' is not a static member of 'class Private::KovanModule'
/build/kiss-platform/common/libkovan/src/kovan_module_p.cpp:122:24: error: 'State' was not declared in this scope
/build/kiss-platform/common/libkovan/src/kovan_module_p.cpp:122:31: error: 'state' was not declared in this scope
/build/kiss-platform/common/libkovan/src/kovan_module_p.cpp:123:1: error: expected ',' or ';' before '{' token
make[2]: *** [CMakeFiles/kovan.dir/src/kovan_module_p.cpp.o] Error 1
make[1]: *** [CMakeFiles/kovan.dir/all] Error 2
make: *** [all] Error 2
make for libkovan failed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.