error: unknown type name ‘namespace’

Requests regarding how to set up experiments in ARGoS.
AntonioC
Posts: 48
Joined: Mon Aug 30, 2021 7:02 pm

error: unknown type name ‘namespace’

Postby AntonioC » Fri Jan 07, 2022 11:52 pm

Since the Kilobot does not have a physical position sensor I used the default position sensor that Argos provides.
In the .argos file I wrote the following piece of code:

Code: Select all

<controllers> <kilobot_controller id="kbc"> <actuators> <kilobot_led implementation="default" /> </actuators> <sensors> <positioning implementation="default" /> </sensors> <params behavior="build/examples/behaviors/blinky" /> </kilobot_controller> </controllers>
In the .c file:

Code: Select all

#include <kilolib.h> #include <stdio.h> #include <argos3/core/utility/math/quaternion.h> void setup() { // Put any setup code here. This is run once before entering the loop. } void loop() { // Put the main code here. This is run repeatedly. // Set the LED red. set_color(RGB(1, 0, 0)); // Wait half a second (500 ms). delay(500); // Set the LED blue. set_color(RGB(0, 0, 1)); // Wait half a second (500 ms). delay(500); printf("X - %f\n", GetX()); } int main() { // Initialize the hardware. kilo_init(); // Register the program. kilo_start(setup, loop); return 0; }
When I run the make command the following output appears:

Code: Select all

antonio@antonio-Lenovo-V110-15AST:~/Downloads/argos3-kilobot-master/build$ make [ 65%] Automatic MOC for target argos3plugin_simulator_kilolib [ 65%] Built target argos3plugin_simulator_kilolib_autogen [ 65%] Built target argos3plugin_simulator_kilolib [ 65%] Automatic MOC for target argos3plugin_simulator_kilobot [ 65%] Built target argos3plugin_simulator_kilobot_autogen [ 65%] Built target argos3plugin_simulator_kilobot [ 65%] Automatic MOC for target kilobot_diffusion [ 65%] Built target kilobot_diffusion_autogen [ 65%] Built target kilobot_diffusion [ 65%] Automatic MOC for target kilobot_phototaxis [ 65%] Built target kilobot_phototaxis_autogen [ 65%] Built target kilobot_phototaxis [ 65%] Automatic MOC for target orbit_star [ 65%] Built target orbit_star_autogen [ 65%] Built target orbit_star [ 65%] Automatic MOC for target test_speaker_mod [ 65%] Built target test_speaker_mod_autogen [ 65%] Built target test_speaker_mod [ 65%] Automatic MOC for target move_to_light [ 65%] Built target move_to_light_autogen [ 65%] Built target move_to_light [ 65%] Automatic MOC for target simple_movement [ 65%] Built target simple_movement_autogen [ 65%] Built target simple_movement [ 65%] Automatic MOC for target gradient_simple [ 65%] Built target gradient_simple_autogen [ 65%] Built target gradient_simple [ 65%] Automatic MOC for target test_listener [ 65%] Built target test_listener_autogen [ 65%] Built target test_listener [ 65%] Automatic MOC for target blinky [ 65%] Built target blinky_autogen Scanning dependencies of target blinky [ 65%] Building C object examples/behaviors/CMakeFiles/blinky.dir/blinky.c.o In file included from /usr/include/argos3/core/utility/math/quaternion.h:10:0, from /home/antonio/Downloads/argos3-kilobot-master/src/examples/behaviors/blinky.c:3: /usr/include/argos3/core/utility/math/vector3.h:10:1: error: unknown type name ‘namespace’ namespace argos { ^~~~~~~~~ /usr/include/argos3/core/utility/math/vector3.h:10:17: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token namespace argos { ^ In file included from /usr/include/argos3/core/utility/math/vector3.h:17:0, from /usr/include/argos3/core/utility/math/quaternion.h:10, from /home/antonio/Downloads/argos3-kilobot-master/src/examples/behaviors/blinky.c:3: /usr/include/argos3/core/utility/math/general.h:13:10: fatal error: vector: No such file or directory #include <vector> ^~~~~~~~ compilation terminated. examples/behaviors/CMakeFiles/blinky.dir/build.make:62: recipe for target 'examples/behaviors/CMakeFiles/blinky.dir/blinky.c.o' failed make[2]: *** [examples/behaviors/CMakeFiles/blinky.dir/blinky.c.o] Error 1 CMakeFiles/Makefile2:773: recipe for target 'examples/behaviors/CMakeFiles/blinky.dir/all' failed make[1]: *** [examples/behaviors/CMakeFiles/blinky.dir/all] Error 2 Makefile:151: recipe for target 'all' failed make: *** [all] Error 2

pincy
Site Admin
Posts: 618
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

Re: error: unknown type name ‘namespace’

Postby pincy » Sat Jan 08, 2022 12:45 am

This is not a bug.

The header you're trying to use is meant to be used with ARGoS controllers, which are written in C++.
Instead, you're working with the C wrapper of the kilobot, which is written in C and had nothing to do with ARGoS controllers.

Kilobots don't have the means to know their position. If that's what you need, consider using a more capable robot instead, such as the Khepera or the foot-bot.
I made ARGoS.


Return to “How to... ?”



cron