[Jderobot-dev] Nuevo Componente(Filtro Rojos)

jgandia jaimerodriguezgandia en gmail.com
Jue Nov 1 05:03:08 CET 2012


*Hola muy buenas, estoy intentando empezar a programar mi primer componente y
me he quedado un poco bloqueado debido a la cantidad de errores que estoy
recibiendo.
Decidi compilar basic_component y leyendo algunos hilos me di cuenta que
necesitaba gazeboserver para poder ejecutar basic_component.
Entonces decidi bajarme Gazebo 0.9 desde sourceforge.net. Buscando por
google  siempre me redirecciona para bajarme:

-player
-stage
-websim

me bajo player-3.0.2.tar.gz
descomprimo
realizo cmake
make
y me da el siguiente error:*

6%] Building CXX object
server/libplayerdrivers/CMakeFiles/playerdrivers.dir/__/drivers/power/oceanserver.o                                                                      
/home/jaime/Downloads/player-3.0.2/server/drivers/power/oceanserver.cc: In
member function ‘bool OceanServer::ReadSensor()’:                                                        
/home/jaime/Downloads/player-3.0.2/server/drivers/power/oceanserver.cc:187:
error: argument of type ‘int
(gbxsmartbatteryacfr::OceanServerSystem::)()const’ does not match ‘float’
/home/jaime/Downloads/player-3.0.2/server/drivers/power/oceanserver.cc:193:
error: invalid types ‘<unresolved overloaded function type>[unsigned int]’
for array subscript
/home/jaime/Downloads/player-3.0.2/server/drivers/power/oceanserver.cc:209:
error: invalid types ‘<unresolved overloaded function type>[unsigned int]’
for array subscript
/home/jaime/Downloads/player-3.0.2/server/drivers/power/oceanserver.cc:212:
error: invalid types ‘<unresolved overloaded function type>[unsigned int]’
for array subscript
/home/jaime/Downloads/player-3.0.2/server/drivers/power/oceanserver.cc:220:
error: invalid types ‘<unresolved overloaded function type>[unsigned int]’
for array subscript
/home/jaime/Downloads/player-3.0.2/server/drivers/power/oceanserver.cc:223:
error: invalid types ‘<unresolved overloaded function type>[unsigned int]’
for array subscript
make[2]: ***
[server/libplayerdrivers/CMakeFiles/playerdrivers.dir/__/drivers/power/oceanserver.o]
Error 1
make[1]: *** [server/libplayerdrivers/CMakeFiles/playerdrivers.dir/all]
Error 2



*Que estoy haciendo mal?

Otra duda:

Estuve mirando el manual de jdeRobot 5.0 y vi como empezar a programar el
primer Hola mundo CLiente-Servidor

hasta el momento entendi que habia que crear un fichero:

Printer.ice:*

 module Demo {
       interface Printer {
            void printString(string s);
       };
    };

*Luego nos dice que hay que crear un  archivo 

Client.cpp:*

#include "Printer.h"
  Ice::CommunicatorPtr ic;
ic = Ice::initialize(argc,argv);
 Ice::ObjectPrx base = ic->stringToProxy("SimplePrinter:default -p 10000");
// -p xxx -> where xxx is the port to send requests
   PrinterPrx printer = PrinterPrx::checkedCast(base); // With the variable
casted "printer" we can acces to remote functions.

  catch (const Ice::Exception& ex) {
     std::cerr << ex << std::endl;
     status = 1;
     } catch (const char* msg) {
     std::cerr << msg << std::endl;
     status = 1;
     }
   
   
     if (ic)
        ic->destroy();




*y un archivo:

Server.cpp:*

 class PrinterI : public Printer {
      public:
          virtual void printString(const string& s, const Ice::Current&);
   };
void 
   PrinterI::printString(const string& s, const Ice::Current&){
       cout << s << endl;
   }
int
   main(int argc, char* argv[])
   {
       int status = 0;
       Ice::CommunicatorPtr ic;
   try {
       ic = Ice::initialize(argc, argv);
   Ice::ObjectAdapterPtr adapter =
ic->createObjectAdapterWithEndpoints("SimplePrinterAdapter", "default -p
10000");
Ice::ObjectPtr object = new PrinterI;
 adapter->add(object, ic->stringToIdentity("SimplePrinter"));
   adapter->activate();
 ic->waitForShutdown();
   } //try
 } catch (const Ice::Exception& e) {
       cerr << e << endl;
       status = 1;
   } catch (const char* msg) {
       cerr << msg << endl;
       status = 1;
   }
   if (ic) {
       try {
           ic->destroy();
       } catch (const Ice::Exception& e) {
           cerr << e << endl;
           status = 1;
       }
   }



*Teniendo estos 3 achivos debemos de ejecutar la siguiente linea:

#> slice2cpp Printer.ice

La cual nos generara un Printer.cpp,Printer.h,Printer.o

siguiendo el manual ejecutamos la siguiente linea:

#> c++ -I. -I$ICE_HOME/include -c Printer.cpp Server.cpp*

*y obtengo la siguiente lista de errores:*

Server.cpp:2: error: expected class-name before ‘{’ token
Server.cpp:4: error: ISO C++ forbids declaration of ‘string’ with no type
Server.cpp:4: error: expected ‘,’ or ‘...’ before ‘&’ token
Server.cpp:7: error: ISO C++ forbids declaration of ‘string’ with no type
Server.cpp:7: error: expected ‘,’ or ‘...’ before ‘&’ token
Server.cpp: In member function ‘virtual void PrinterI::printString(int)’:
Server.cpp:8: error: ‘cout’ was not declared in this scope
Server.cpp:8: error: ‘s’ was not declared in this scope
Server.cpp:8: error: ‘endl’ was not declared in this scope
Server.cpp: In function ‘int main(int, char**)’:
Server.cpp:14: error: ‘Ice’ has not been declared
Server.cpp:14: error: expected ‘;’ before ‘ic’
Server.cpp:16: error: ‘ic’ was not declared in this scope
Server.cpp:16: error: ‘Ice’ has not been declared
Server.cpp:17: error: ‘Ice’ has not been declared
Server.cpp:17: error: expected ‘;’ before ‘adapter’
Server.cpp:18: error: ‘Ice’ has not been declared
Server.cpp:18: error: expected ‘;’ before ‘object’
Server.cpp:19: error: ‘adapter’ was not declared in this scope
Server.cpp:19: error: ‘object’ was not declared in this scope
Server.cpp:23: error: expected ‘catch’ before ‘}’ token
Server.cpp:23: error: expected ‘(’ before ‘}’ token
Server.cpp:23: error: expected type-specifier before ‘}’ token
Server.cpp:23: error: expected ‘)’ before ‘}’ token
Server.cpp:23: error: expected ‘{’ before ‘}’ token
Server.cpp: At global scope:
Server.cpp:23: error: expected unqualified-id before ‘catch’
Server.cpp:26: error: expected unqualified-id before ‘catch’
Server.cpp:30: error: expected unqualified-id before ‘if’


*La verdad es que me he quedado bloqueado no se por donde seguir, me
gustaria realizar un componente que hiciera un filtro de rojos a un video
reproducido en cameraserver.
Un saludo y perdon por las molestias*



--
View this message in context: http://jderobot-developer-list.2315034.n4.nabble.com/Nuevo-Componente-Filtro-Rojos-tp4640802.html
Sent from the Jderobot Developer List mailing list archive at Nabble.com.


More information about the Jde-developers mailing list