demiurge-project / argos3-epuck

Plugin for argos3 containing a model of the e-puck robot extended with ground sensor, range-and-bearing board, Omnivision module, and Linux board.
Other
11 stars 11 forks source link

Problem with cross-compilation #16

Closed jstovold closed 5 years ago

jstovold commented 6 years ago

When cross compiling (following the instructions provided to the letter), I get the following error after running make in argos3-epuck/epuck_build. The step I am at in the instructions:

Configure the cross-compilation of argos3-epuck: Configure the plugin:

I am installing on a clean VM with Ubuntu 18.04 (I have also tried with Ubuntu 16.04 but get the exact same problem). It feels like a missing header to ci_controller.h in the cmake definition somewhere.

/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/lib/argos3/libargos3core_epuck.so: undefined reference to `ControllerMaker'
collect2: ld returned 1 exit status
plugins/robots/e-puck/CMakeFiles/epuck_camera_configurator_server.dir/build.make:198: recipe for target 'plugins/robots/e-puck/epuck_camera_configurator_server' failed
make[2]: *** [plugins/robots/e-puck/epuck_camera_configurator_server] Error 1
CMakeFiles/Makefile2:123: recipe for target 'plugins/robots/e-puck/CMakeFiles/epuck_camera_configurator_server.dir/all' failed
make[1]: *** [plugins/robots/e-puck/CMakeFiles/epuck_camera_configurator_server.dir/all] Error 2
Makefile:139: recipe for target 'all' failed
make: *** [all] Error 2
KenN7 commented 6 years ago

did you cross compile and install argos3 with the same compiler first ?

jstovold commented 6 years ago

Yes, followed the instructions throughout

jstovold commented 6 years ago

Just running through the whole process again (this time on 16.04) -- when compiling argos3 for the simulation, it works fine. when cross-compiling argos3 with angstrom I get the following error:

In file included from /home/james/Downloads/argos3-master/src/argos3/core/utility/math/matrix/rotationmatrix3.h:17,
                 from /home/james/Downloads/argos3-master/src/argos3/core/utility/math/quaternion.h:11,
                 from /home/james/Downloads/argos3-master/src/core/utility/math/box.h:16,
                 from /home/james/Downloads/argos3-master/src/core/utility/math/box.cpp:1:
/home/james/Downloads/argos3-master/src/argos3/core/utility/math/matrix/squarematrix.h: In member function ‘argos::Real argos::CSquareMatrix<DIM>::GetDeterminant() const’:
/home/james/Downloads/argos3-master/src/argos3/core/utility/math/matrix/squarematrix.h:75: error: call of overloaded ‘pow(double&, unsigned int&)’ is ambiguous
/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/usr/include/bits/mathcalls.h:154: note: candidates are: double pow(double, double)
/usr/local/angstrom/arm/lib/gcc/arm-angstrom-linux-gnueabi/4.3.3/../../../../arm-angstrom-linux-gnueabi/include/c++/4.3.3/cmath:359: note:                 float std::pow(float, float)

and then a load of options for std::pow -- I can get rid of this error by inserting static_cast's around the parameters for std::pow (at squarematrix.h:75 and squarematrix.h:104). This then lets the build continue, until I get the following error:

In file included from /usr/local/angstrom/arm/lib/gcc/arm-angstrom-linux-gnueabi/4.3.3/../../../../arm-angstrom-linux-gnueabi/include/c++/4.3.3/array:40,
                 from /home/james/Downloads/argos3-master/src/plugins/robots/generic/control_interface/ci_camera_sensor_algorithms/ci_camera_sensor_tag_detector_algorithm.h:17,
                 from /home/james/Downloads/argos3-master/src/plugins/robots/generic/control_interface/ci_camera_sensor_algorithms/ci_camera_sensor_tag_detector_algorithm.cpp:7:
/usr/local/angstrom/arm/lib/gcc/arm-angstrom-linux-gnueabi/4.3.3/../../../../arm-angstrom-linux-gnueabi/include/c++/4.3.3/c++0x_warning.h:36:2: error: #error This file requires compiler and library support for the upcoming ISO C++ standard, C++0x. This support is currently experimental, and must be enabled with the -std=c++0x or -std=gnu++0x compiler options.
plugins/robots/generic/CMakeFiles/argos3plugin_epuck_genericrobot.dir/build.make:182: recipe for target 'plugins/robots/generic/CMakeFiles/argos3plugin_epuck_genericrobot.dir/control_interface/ci_camera_sensor_algorithms/ci_camera_sensor_tag_detector_algorithm.cpp.o' failed
make[2]: *** [plugins/robots/generic/CMakeFiles/argos3plugin_epuck_genericrobot.dir/control_interface/ci_camera_sensor_algorithms/ci_camera_sensor_tag_detector_algorithm.cpp.o] Error 1
CMakeFiles/Makefile2:176: recipe for target 'plugins/robots/generic/CMakeFiles/argos3plugin_epuck_genericrobot.dir/all' failed
make[1]: *** [plugins/robots/generic/CMakeFiles/argos3plugin_epuck_genericrobot.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

which can be fixed by adding the -std=c++0x flag to the cmake file. This then gives the following errors:

In file included from /home/james/Downloads/argos3-master/src/plugins/robots/generic/control_interface/ci_magnets_actuator.cpp:7:
/home/james/Downloads/argos3-master/src/plugins/robots/generic/control_interface/ci_magnets_actuator.h:29: error: expected nested-name-specifier before ‘TVector’
/home/james/Downloads/argos3-master/src/plugins/robots/generic/control_interface/ci_magnets_actuator.h:29: error: using-declaration for non-member at class scope
/home/james/Downloads/argos3-master/src/plugins/robots/generic/control_interface/ci_magnets_actuator.h:29: error: expected `;' before ‘=’ token
/home/james/Downloads/argos3-master/src/plugins/robots/generic/control_interface/ci_magnets_actuator.h:29: error: expected unqualified-id before ‘=’ token
/home/james/Downloads/argos3-master/src/plugins/robots/generic/control_interface/ci_magnets_actuator.h:49: error: type ‘argos::CCI_MagnetsActuator::SInterface’ is not derived from type ‘argos::CCI_MagnetsActuator’
/home/james/Downloads/argos3-master/src/plugins/robots/generic/control_interface/ci_magnets_actuator.h:49: error: expected ‘;’ before ‘&’ token
/home/james/Downloads/argos3-master/src/plugins/robots/generic/control_interface/ci_magnets_actuator.h:57: error: ‘TVector’ in class ‘argos::CCI_MagnetsActuator::SInterface’ does not name a type
/home/james/Downloads/argos3-master/src/plugins/robots/generic/control_interface/ci_magnets_actuator.cpp:18: error: expected constructor, destructor, or type conversion before ‘&’ token
plugins/robots/generic/CMakeFiles/argos3plugin_epuck_genericrobot.dir/build.make:422: recipe for target 'plugins/robots/generic/CMakeFiles/argos3plugin_epuck_genericrobot.dir/control_interface/ci_magnets_actuator.cpp.o' failed
make[2]: *** [plugins/robots/generic/CMakeFiles/argos3plugin_epuck_genericrobot.dir/control_interface/ci_magnets_actuator.cpp.o] Error 1
CMakeFiles/Makefile2:176: recipe for target 'plugins/robots/generic/CMakeFiles/argos3plugin_epuck_genericrobot.dir/all' failed
make[1]: *** [plugins/robots/generic/CMakeFiles/argos3plugin_epuck_genericrobot.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

Which can be fixed by changing:

         using TVector = std::vector<SInterface>;

to

         typedef std::vector<SInterface> TVector;

in ci_magnets_actutator.h (and a bunch of other .h files), some of which also need this:

                    const std::vector<CByteArray>& vec_data = {}) :

changing to this:

SInterface(const std::string& str_id,
                    const std::vector<CByteArray>& vec_data) :

Once I've completed all these, argos3 cross-compiles successfully. Argos3-epuck will then compile correctly for the simulator, but cross-compiling it fails with the error described above. I don't know whether there is a dependency that isn't listed or something but hopefully this will help?

KenN7 commented 6 years ago

what cross-compiler did you use? which version of gcc ?

jstovold commented 6 years ago

gcc: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 cross-compiler: arm-angstrom-linux-gnueabi-gcc (GCC) 4.3.3

The cross compiler is the one recommended in the documentation

jstovold commented 6 years ago

This morning I tried with more up-to-date gcc (7.1.0) and with different cross-compiler (arm-linux-gnueabi-gcc v5.4.0), but the same problems as before. It feels like a header file is missing from the build options cmake file, but I don't know the argos structure well enough to see where to put any missing files.

jstovold commented 6 years ago

OK, I've managed to get the cross-compilation to work by rolling back to v48 of both argos3 and the epuck plugin -- seems the cross compiler recommended in the instructions doesn't like the changes released after v48.

Now I'm just trying to get the controller to cross-compile -- is there anything specific I need to do to get it running on the robot?

KenN7 commented 6 years ago

Hi, sorry for not mentioning it, indeed this repo is for now only fully tested with v48 (last release) and beta-48 of argos. About running on the robot, it heavily depends on what system runs on your robot, you will have to have a version of gcc and libs that match the ones on your robot's linux board.

jstovold commented 6 years ago

OK -- do you know of any guides / tutorials for cross-compiling the controller code from argos into the robot (assuming the compiler / libraries all match)?

KenN7 commented 6 years ago

It is the way setup as for compiling argos3-epuck, e.g. you set up your project with cmake and use: cmake -DCMAKE_TOOLCHAIN_FILE=../src/cmake/TargetEPuck.cmake ../src to cross-compile it

jstovold commented 6 years ago

OK -- I've worked out why I am having so much trouble getting this working. It looks like the epuck2 doesn't use serial communication for the gumstix board, it uses the i2c instead, meaning that my argos program is just sitting waiting for data to arrive through the serial connection. And the firmware in this repo is designed for the pic board on the epuck1, not the STMicro on the epuck2.

Do you know if anybody has written an updated firmware for the epuck2 or should I go ahead and start writing it?

KenN7 commented 6 years ago

To my knowledge, there is no firmware for epuck2. We are working with epuck1 and we don't have any epuck2.