Update of /cvsroot/robotflow/RobotFlow/MARIE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18474/src Modified Files: Makefile.am MarieCommandBehavior.cpp MarieCommandCamera.cpp MarieCommandJoystick.cpp MarieCommandMotor.cpp MarieDataBumper.cpp MarieDataCamera.cpp MarieDataIR.cpp MarieDataLaser.cpp MarieDataLocalisation.cpp MarieDataMap.cpp MarieDataOdometry.cpp MarieDataRaw.cpp MarieDataSonar.cpp MarieObject.cpp MariePeek.cpp MariePull.cpp MariePush.cpp MarieRequestSystem.cpp extractMarieCommandBehavior.cpp extractMarieCommandCamera.cpp extractMarieCommandJoystick.cpp extractMarieCommandMotor.cpp extractMarieDataBumper.cpp extractMarieDataCamera.cpp extractMarieDataIR.cpp extractMarieDataLaser.cpp extractMarieDataLocalisation.cpp extractMarieDataMap.cpp extractMarieDataOdometry.cpp extractMarieDataRaw.cpp extractMarieDataSonar.cpp extractMarieRequestSystem.cpp isMarieDataNull.cpp newMarieCommandBehavior.cpp newMarieCommandCamera.cpp newMarieCommandJoystick.cpp newMarieCommandMotor.cpp newMarieDataBumper.cpp newMarieDataCamera.cpp newMarieDataIR.cpp newMarieDataLaser.cpp newMarieDataLocalisation.cpp newMarieDataMap.cpp newMarieDataOdometry.cpp newMarieDataRaw.cpp newMarieDataSonar.cpp newMarieRequestSystem.cpp Log Message: Remove useless Flowdesigner types for MARIE. Add MarieObject as a dataAbstract container. Remove multiple inheritance. Index: MarieDataCamera.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/MarieDataCamera.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MarieDataCamera.cpp 7 Sep 2005 21:12:48 -0000 1.8 --- MarieDataCamera.cpp 12 Sep 2005 21:31:19 -0000 1.9 *************** *** 30,78 **** namespace marie { ! DECLARE_TYPE2(DataCamera::ID,MarieDataCamera) ! ! using namespace std; ! ! MarieDataCamera::MarieDataCamera() ! { ! ! } ! ! MarieDataCamera::MarieDataCamera (const DataCamera &data) ! : DataCamera(data) ! { ! ! } ! ! void MarieDataCamera::printOn(ostream &out) const ! { ! MarieXMLDataFactory factory; ! ! //writing XML data ! string value = factory.toString((DataCamera) (*this)); ! ! out.write(value.c_str(), value.size()); ! } ! ! void MarieDataCamera::readFrom(istream &in) ! { ! throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! } ! ! void MarieDataCamera::copyDataAbstract(DataAbstract *data) ! { ! if (data) ! { ! DataCamera *my_data = dynamic_cast<DataCamera*>(data); ! if (my_data) ! { ! //((DataCamera*)this)->operator=(*my_data); ! this->DataCamera::operator=(*my_data); ! } ! else ! { ! throw new GeneralException(string("Unable to cast into DataCamera Abstract : ") + data->getID(),__FILE__,__LINE__); ! } ! } ! } } --- 30,78 ---- namespace marie { ! // DECLARE_TYPE2(DataCamera::ID,MarieDataCamera) ! // ! // using namespace std; ! // ! // MarieDataCamera::MarieDataCamera() ! // { ! // ! // } ! // ! // MarieDataCamera::MarieDataCamera (const DataCamera &data) ! // : DataCamera(data) ! // { ! // ! // } ! // ! // void MarieDataCamera::printOn(ostream &out) const ! // { ! // MarieXMLDataFactory factory; ! // ! // //writing XML data ! // string value = factory.toString((DataCamera) (*this)); ! // ! // out.write(value.c_str(), value.size()); ! // } ! // ! // void MarieDataCamera::readFrom(istream &in) ! // { ! // throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! // } ! // ! // void MarieDataCamera::copyDataAbstract(DataAbstract *data) ! // { ! // if (data) ! // { ! // DataCamera *my_data = dynamic_cast<DataCamera*>(data); ! // if (my_data) ! // { ! // //((DataCamera*)this)->operator=(*my_data); ! // this->DataCamera::operator=(*my_data); ! // } ! // else ! // { ! // throw new GeneralException(string("Unable to cast into DataCamera Abstract : ") + data->getID(),__FILE__,__LINE__); ! // } ! // } ! // } } Index: extractMarieDataIR.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/extractMarieDataIR.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** extractMarieDataIR.cpp 29 Mar 2005 15:20:43 -0000 1.4 --- extractMarieDataIR.cpp 12 Sep 2005 21:31:19 -0000 1.5 *************** *** 22,30 **** #include <sstream> #include <string> - #include "MarieDataIR.h" - #include "MarieXMLDataFactory.h" - #include "Behavior.h" #include "Vector.h" ! #include "MarieDataNull.h" using namespace std; --- 22,29 ---- #include <sstream> #include <string> #include "Vector.h" ! #include "BufferedNode.h" ! #include "MarieObject.h" ! #include "DataIR.h" using namespace std; *************** *** 33,110 **** namespace marie { ! //forward declaration ! class extractMarieDataIR; ! ! DECLARE_NODE(extractMarieDataIR) ! /*Node * * @name extractMarieDataIR * @category RobotFlow:MARIE:DATA ! * @description Extract data in the FlowDesigner format from MarieDataIR * * @input_name DATA_IR ! * @input_type MarieDataIR ! * @input_description MarieDataIR object * * @output_name RANGES ! * @output_description Range contained in the MarieDataIR object * @output_type Vector<int> ! * ! END*/ ! ! ! using namespace std; ! ! class extractMarieDataIR : public BufferedNode ! { ! ! private: ! //intputs ! int m_dataIRID; ! ! //outputs ! int m_rangesID; ! ! public: ! ! ! extractMarieDataIR(string nodeName, ParameterSet params) ! : BufferedNode(nodeName,params) ! { ! //inputs ! m_dataIRID = addInput("DATA_IR"); ! //outputs ! m_rangesID = addOutput("RANGES"); ! } ! ! void calculate(int output_id, int count, Buffer &out) ! { ! try { ! //get input ! RCPtr<MarieDataIR> data = getInput(m_dataIRID,count); ! ! unsigned int size = data->getNbIR(); ! const unsigned int *ranges = data->getRanges(); ! ! //copy range data into a vector ! Vector<int> *vect = Vector<int>::alloc(size); ! ! for (unsigned int i = 0; i < size; i++) ! { ! (*vect)[i] = (int) ranges[i]; ! } ! ! //output vector ! out[count] = ObjectRef(vect); } ! catch (BaseException *e) { ! e->print(cerr); ! e->add(new GeneralException("Unable to process",__FILE__,__LINE__)); ! throw e; } - } };//class extractMarieDataIR }//namespace marie --- 32,115 ---- namespace marie { ! //forward declaration ! class extractMarieDataIR; ! ! DECLARE_NODE(extractMarieDataIR) ! /*Node * * @name extractMarieDataIR * @category RobotFlow:MARIE:DATA ! * @description Extract data in the FlowDesigner format from MarieObject * * @input_name DATA_IR ! * @input_type MarieObject ! * @input_description input MarieObject object containing a DataIR * * @output_name RANGES ! * @output_description Range contained in the DataIR object * @output_type Vector<int> ! * ! END*/ ! ! using namespace std; ! ! class extractMarieDataIR : public BufferedNode ! { ! ! private: ! //intputs ! int m_dataIRID; ! //outputs ! int m_rangesID; ! ! public: ! ! extractMarieDataIR(string nodeName, ParameterSet params) ! : BufferedNode(nodeName,params) { ! //inputs ! m_dataIRID = addInput("DATA_IR"); ! ! //outputs ! m_rangesID = addOutput("RANGES"); } ! ! void calculate(int output_id, int count, Buffer &out) { ! try ! { ! //get input ! RCPtr<MarieObject> dataPtr = getInput(m_dataIRID,count); ! DataIR *dataIR = dynamic_cast<DataIR*>(dataPtr->getData()); ! if (dataIR != NULL) ! { ! unsigned int size = dataIR->getNbIR(); ! const unsigned int *ranges = dataIR->getRanges(); ! ! //copy range data into a vector ! Vector<int> *vect = Vector<int>::alloc(size); ! ! for (unsigned int i = 0; i < size; i++) ! { ! (*vect)[i] = (int) ranges[i]; ! } ! ! //output vector ! out[count] = ObjectRef(vect); ! } ! else ! { ! std::cerr << "FD::extractMarieCommandCamera -> MarieObject received data not of CommandCamera type" << std::endl; ! out[count] = nilObject; ! } ! } ! catch (BaseException *e) ! { ! e->print(cerr); ! e->add(new GeneralException("Unable to process",__FILE__,__LINE__)); ! throw e; ! } } };//class extractMarieDataIR }//namespace marie Index: Makefile.am =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/Makefile.am,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Makefile.am 12 Sep 2005 13:17:32 -0000 1.27 --- Makefile.am 12 Sep 2005 21:31:19 -0000 1.28 *************** *** 13,31 **** MariePush.cpp \ MariePeek.cpp \ ! MarieDataLaser.cpp \ ! MarieDataLocalisation.cpp \ ! MarieDataSonar.cpp \ ! MarieDataCamera.cpp \ ! MarieDataOdometry.cpp \ ! MarieDataNull.cpp \ ! MarieDataRaw.cpp \ ! MarieDataIR.cpp \ ! MarieDataBumper.cpp \ ! MarieDataMap.cpp \ ! MarieCommandBehavior.cpp \ ! MarieCommandCamera.cpp \ ! MarieCommandMotor.cpp \ ! MarieCommandJoystick.cpp \ ! MarieRequestSystem.cpp \ newMarieDataLaser.cpp \ newMarieDataLocalisation.cpp \ --- 13,17 ---- MariePush.cpp \ MariePeek.cpp \ ! MarieObject.cpp \ newMarieDataLaser.cpp \ newMarieDataLocalisation.cpp \ *************** *** 43,46 **** --- 29,33 ---- newMarieCommandMotor.cpp \ newMarieCommandJoystick.cpp \ + newMarieDataNull.cpp \ extractMarieDataLaser.cpp \ extractMarieDataLocalisation.cpp \ *************** *** 58,62 **** extractMarieCommandJoystick.cpp \ isMarieDataNull.cpp ! install-data-local: --- 45,64 ---- extractMarieCommandJoystick.cpp \ isMarieDataNull.cpp ! # MarieDataLaser.cpp \ ! # MarieDataLocalisation.cpp \ ! # MarieDataSonar.cpp \ ! # MarieDataCamera.cpp \ ! # MarieDataOdometry.cpp \ ! # MarieDataNull.cpp \ ! # MarieDataRaw.cpp \ ! # MarieDataIR.cpp \ ! # MarieDataBumper.cpp \ ! # MarieDataMap.cpp \ ! # MarieCommandBehavior.cpp \ ! # MarieCommandCamera.cpp \ ! # MarieCommandMotor.cpp \ ! # MarieCommandJoystick.cpp \ ! # MarieRequestSystem.cpp \ ! # install-data-local: Index: MarieDataBumper.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/MarieDataBumper.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MarieDataBumper.cpp 7 Sep 2005 21:12:48 -0000 1.7 --- MarieDataBumper.cpp 12 Sep 2005 21:31:19 -0000 1.8 *************** *** 32,78 **** using namespace std; ! DECLARE_TYPE2(DataBumper::ID,MarieDataBumper) ! ! MarieDataBumper::MarieDataBumper() ! { ! ! } ! ! MarieDataBumper::MarieDataBumper (const DataBumper &command) ! :DataBumper(command) ! { ! ! } ! ! void MarieDataBumper::printOn(ostream &out) const ! { ! MarieXMLDataFactory factory; ! ! //writing XML data ! string value = factory.toString((DataBumper) (*this)); ! ! out.write(value.c_str(), value.size()); ! } ! ! void MarieDataBumper::readFrom(istream &in) ! { ! throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! } ! ! void MarieDataBumper::copyDataAbstract(DataAbstract *data) ! { ! if (data) ! { ! DataBumper *command = dynamic_cast<DataBumper*>(data); ! if (command) ! { ! //((DataBumper*)this)->operator=(*command); ! this->DataBumper::operator=(*command); ! } ! else ! { ! throw new GeneralException(string("Unable to cast into DataBumper Abstract : ") + data->getID(),__FILE__,__LINE__); ! } ! } ! } } --- 32,78 ---- using namespace std; ! // DECLARE_TYPE2(DataBumper::ID,MarieDataBumper) ! // ! // MarieDataBumper::MarieDataBumper() ! // { ! // ! // } ! // ! // MarieDataBumper::MarieDataBumper (const DataBumper &command) ! // :DataBumper(command) ! // { ! // ! // } ! // ! // void MarieDataBumper::printOn(ostream &out) const ! // { ! // MarieXMLDataFactory factory; ! // ! // //writing XML data ! // string value = factory.toString((DataBumper) (*this)); ! // ! // out.write(value.c_str(), value.size()); ! // } ! // ! // void MarieDataBumper::readFrom(istream &in) ! // { ! // throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! // } ! // ! // void MarieDataBumper::copyDataAbstract(DataAbstract *data) ! // { ! // if (data) ! // { ! // DataBumper *command = dynamic_cast<DataBumper*>(data); ! // if (command) ! // { ! // //((DataBumper*)this)->operator=(*command); ! // this->DataBumper::operator=(*command); ! // } ! // else ! // { ! // throw new GeneralException(string("Unable to cast into DataBumper Abstract : ") + data->getID(),__FILE__,__LINE__); ! // } ! // } ! // } } Index: MarieRequestSystem.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/MarieRequestSystem.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** MarieRequestSystem.cpp 7 Sep 2005 21:12:48 -0000 1.6 --- MarieRequestSystem.cpp 12 Sep 2005 21:31:19 -0000 1.7 *************** *** 28,77 **** using namespace FD; ! namespace marie ! { ! DECLARE_TYPE2(RequestSystem::ID,MarieRequestSystem) ! ! using namespace std; ! ! MarieRequestSystem::MarieRequestSystem() ! { ! ! } ! ! MarieRequestSystem::MarieRequestSystem (const RequestSystem &data) ! :RequestSystem(data) ! { ! ! } ! ! void MarieRequestSystem::printOn(ostream &out) const ! { ! MarieXMLDataFactory factory; ! ! //writing XML data ! string value = factory.toString((RequestSystem) (*this)); ! ! out.write(value.c_str(), value.size()); ! } ! ! void MarieRequestSystem::readFrom(istream &in) ! { ! throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! } ! ! void MarieRequestSystem::copyDataAbstract(DataAbstract *data) ! { ! if (data) ! { ! RequestSystem *my_data = dynamic_cast<RequestSystem*>(data); ! if (my_data) ! { ! this->RequestSystem::operator=(*my_data); ! } ! else ! { ! throw new GeneralException(string("Unable to cast into RequestSystem Abstract : ") + data->getID(),__FILE__,__LINE__); ! } ! } ! } ! } --- 28,77 ---- using namespace FD; ! // namespace marie ! // { ! // DECLARE_TYPE2(RequestSystem::ID,MarieRequestSystem) ! // ! // using namespace std; ! // ! // MarieRequestSystem::MarieRequestSystem() ! // { ! // ! // } ! // ! // MarieRequestSystem::MarieRequestSystem (const RequestSystem &data) ! // :RequestSystem(data) ! // { ! // ! // } ! // ! // void MarieRequestSystem::printOn(ostream &out) const ! // { ! // MarieXMLDataFactory factory; ! // ! // //writing XML data ! // string value = factory.toString((RequestSystem) (*this)); ! // ! // out.write(value.c_str(), value.size()); ! // } ! // ! // void MarieRequestSystem::readFrom(istream &in) ! // { ! // throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! // } ! // ! // void MarieRequestSystem::copyDataAbstract(DataAbstract *data) ! // { ! // if (data) ! // { ! // RequestSystem *my_data = dynamic_cast<RequestSystem*>(data); ! // if (my_data) ! // { ! // this->RequestSystem::operator=(*my_data); ! // } ! // else ! // { ! // throw new GeneralException(string("Unable to cast into RequestSystem Abstract : ") + data->getID(),__FILE__,__LINE__); ! // } ! // } ! // } ! // } Index: MarieDataSonar.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/MarieDataSonar.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MarieDataSonar.cpp 7 Sep 2005 21:12:48 -0000 1.8 --- MarieDataSonar.cpp 12 Sep 2005 21:31:19 -0000 1.9 *************** *** 29,79 **** using namespace FD; ! namespace marie ! { ! DECLARE_TYPE2(DataSonar::ID,MarieDataSonar) ! ! using namespace std; ! ! MarieDataSonar::MarieDataSonar() ! { ! ! } ! ! MarieDataSonar::MarieDataSonar (const DataSonar &data) ! :DataSonar(data) ! { ! ! } ! ! void MarieDataSonar::printOn(ostream &out) const ! { ! MarieXMLDataFactory factory; ! ! //writing XML data ! string value = factory.toString((DataSonar) (*this)); ! ! out.write(value.c_str(), value.size()); ! } ! ! void MarieDataSonar::readFrom(istream &in) ! { ! throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! } ! ! void MarieDataSonar::copyDataAbstract(DataAbstract *data) ! { ! if (data) ! { ! DataSonar *my_data = dynamic_cast<DataSonar*>(data); ! if (my_data) ! { ! //((DataSonar*)this)->operator=(*my_data); ! this->DataSonar::operator=(*my_data); ! } ! else ! { ! throw new GeneralException(string("Unable to cast into DataSonar Abstract : ") + data->getID(),__FILE__,__LINE__); ! } ! } ! } ! } --- 29,79 ---- using namespace FD; ! // namespace marie ! // { ! // DECLARE_TYPE2(DataSonar::ID,MarieDataSonar) ! // ! // using namespace std; ! // ! // MarieDataSonar::MarieDataSonar() ! // { ! // ! // } ! // ! // MarieDataSonar::MarieDataSonar (const DataSonar &data) ! // :DataSonar(data) ! // { ! // ! // } ! // ! // void MarieDataSonar::printOn(ostream &out) const ! // { ! // MarieXMLDataFactory factory; ! // ! // //writing XML data ! // string value = factory.toString((DataSonar) (*this)); ! // ! // out.write(value.c_str(), value.size()); ! // } ! // ! // void MarieDataSonar::readFrom(istream &in) ! // { ! // throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! // } ! // ! // void MarieDataSonar::copyDataAbstract(DataAbstract *data) ! // { ! // if (data) ! // { ! // DataSonar *my_data = dynamic_cast<DataSonar*>(data); ! // if (my_data) ! // { ! // //((DataSonar*)this)->operator=(*my_data); ! // this->DataSonar::operator=(*my_data); ! // } ! // else ! // { ! // throw new GeneralException(string("Unable to cast into DataSonar Abstract : ") + data->getID(),__FILE__,__LINE__); ! // } ! // } ! // } ! // } Index: MarieObject.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/MarieObject.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MarieObject.cpp 30 May 2004 12:34:07 -0000 1.1 --- MarieObject.cpp 12 Sep 2005 21:31:19 -0000 1.2 *************** *** 31,35 **** --- 31,90 ---- // + #include "MarieObject.h" + #include "MarieXMLDataFactory.h" + #include <string> + #include <iostream> + namespace marie { + MarieObject::MarieObject(DataAbstract *data) + : m_data(data) + { + + } + + void MarieObject::printOn(std::ostream &out) const + { + MarieXMLDataFactory factory; + + //writing XML data + std::string value = factory.toString((*m_data)); + + out.write(value.c_str(), value.size()); + } + + MarieObject::~MarieObject() + { + if (m_data != NULL) + { + delete m_data; + } + } + + DataAbstract* MarieObject::getData() + { + return(m_data); + } + + void MarieObject::readFrom(std::istream &in) + { + throw new FD::GeneralException("readFrom not supported for type : " + m_data->getID() + " Use the MariePull Node to read data from the stream.",__FILE__,__LINE__); + } + + // virtual void MarieObject::copyDataAbstract(DataAbstract *data) + // { + // if (data) + // { + // C *marieObjectPtr = dynamic_cast<C*>(data); + // if (marieObjectPtr) + // { + // this->C::operator=(*marieObjectPtr); + // } + // else + // { + // throw new GeneralException(string("Unable to cast into" + C::ID + " Abstract : ") + data->getID(),__FILE__,__LINE__); + // } + // } + // } + } Index: extractMarieCommandJoystick.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/extractMarieCommandJoystick.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** extractMarieCommandJoystick.cpp 29 Mar 2005 15:20:43 -0000 1.3 --- extractMarieCommandJoystick.cpp 12 Sep 2005 21:31:19 -0000 1.4 *************** *** 22,30 **** #include <sstream> #include <string> ! #include "MarieCommandJoystick.h" ! #include "MarieXMLDataFactory.h" ! #include "Behavior.h" ! #include "Vector.h" ! #include "MarieDataNull.h" using namespace std; --- 22,28 ---- #include <sstream> #include <string> ! #include "BufferedNode.h" ! #include "MarieObject.h" ! #include "CommandJoystick.h" using namespace std; *************** *** 33,49 **** namespace marie { ! //forward declaration ! class extractMarieCommandJoystick; ! ! DECLARE_NODE(extractMarieCommandJoystick) ! /*Node * * @name extractMarieCommandJoystick * @category RobotFlow:MARIE:COMMAND ! * @description Extract data in the FlowDesigner format from MarieCommandJoystick * * @input_name COMMAND_JOYSTICK ! * @input_type MarieCommandJoystick ! * @input_description The MarieCommandJoystick object * * @output_name X --- 31,47 ---- namespace marie { ! //forward declaration ! class extractMarieCommandJoystick; ! ! DECLARE_NODE(extractMarieCommandJoystick) ! /*Node * * @name extractMarieCommandJoystick * @category RobotFlow:MARIE:COMMAND ! * @description Extract data in the FlowDesigner format from MarieObject * * @input_name COMMAND_JOYSTICK ! * @input_type MarieObject ! * @input_description The MarieObject object containing a CommandJoystick * * @output_name X *************** *** 79,156 **** * @output_description output button state, nilObject if not used * ! END*/ ! ! ! using namespace std; ! ! class extractMarieCommandJoystick : public BufferedNode ! { ! ! private: ! ! //intputs ! int m_commandInID; ! ! //outputs ! int m_xOutID; ! int m_yOutID; ! int m_xminOutID; ! int m_yminOutID; ! int m_xmaxOutID; ! int m_ymaxOutID; ! int m_nbButtonsOutID; ! int m_buttonStateOutID; ! ! public: ! ! ! extractMarieCommandJoystick(string nodeName, ParameterSet params) ! : BufferedNode(nodeName,params) ! { ! //inputs ! m_commandInID = addInput("COMMAND_JOYSTICK"); ! //outputs ! m_xOutID = addOutput("X"); ! m_yOutID = addOutput("Y"); ! m_xminOutID = addOutput("XMIN"); ! m_yminOutID = addOutput("YMIN"); ! m_xmaxOutID = addOutput("XMAX"); ! m_ymaxOutID = addOutput("YMAX"); ! m_nbButtonsOutID = addOutput("NBBUTTONS"); ! m_buttonStateOutID = addOutput("BUTTONSTATE"); ! } ! ! void calculate(int output_id, int count, Buffer &out) ! { ! try ! { ! RCPtr<MarieCommandJoystick> command = getInput(m_commandInID,count); ! ! int x, y, xmin, ymin, xmax, ymax, nbButtons, buttonState = 0; ! ! command->getXY(x, y); ! command->getMinXY(xmin, ymin); ! command->getMaxXY(xmax, ymax); ! nbButtons = command->getNbButtons(); ! buttonState = command->getButtonState(); ! ! //output data ! (*outputs[m_xOutID].buffer)[count] = ObjectRef(Int::alloc(x)); ! (*outputs[m_yOutID].buffer)[count] = ObjectRef(Int::alloc(y)); ! (*outputs[m_xminOutID].buffer)[count] = ObjectRef(Int::alloc(xmin)); ! (*outputs[m_yminOutID].buffer)[count] = ObjectRef(Int::alloc(ymin)); ! (*outputs[m_xmaxOutID].buffer)[count] = ObjectRef(Int::alloc(xmax)); ! (*outputs[m_ymaxOutID].buffer)[count] = ObjectRef(Int::alloc(ymax)); ! (*outputs[m_nbButtonsOutID].buffer)[count] = ObjectRef(Int::alloc(nbButtons)); ! (*outputs[m_buttonStateOutID].buffer)[count] = ObjectRef(Int::alloc(buttonState)); } ! catch (BaseException *e) { ! e->print(cerr); ! e->add(new GeneralException("Unable to process",__FILE__,__LINE__)); ! throw e; } - } };//class extractMarieCommandJoystick }//namespace marie --- 77,160 ---- * @output_description output button state, nilObject if not used * ! END*/ ! ! using namespace std; ! ! class extractMarieCommandJoystick : public BufferedNode ! { ! ! private: ! ! //intputs ! int m_commandInID; ! //outputs ! int m_xOutID; ! int m_yOutID; ! int m_xminOutID; ! int m_yminOutID; ! int m_xmaxOutID; ! int m_ymaxOutID; ! int m_nbButtonsOutID; ! int m_buttonStateOutID; ! ! public: ! ! extractMarieCommandJoystick(string nodeName, ParameterSet params) ! : BufferedNode(nodeName,params) ! { ! //inputs ! m_commandInID = addInput("COMMAND_JOYSTICK"); ! ! //outputs ! m_xOutID = addOutput("X"); ! m_yOutID = addOutput("Y"); ! m_xminOutID = addOutput("XMIN"); ! m_yminOutID = addOutput("YMIN"); ! m_xmaxOutID = addOutput("XMAX"); ! m_ymaxOutID = addOutput("YMAX"); ! m_nbButtonsOutID = addOutput("NBBUTTONS"); ! m_buttonStateOutID = addOutput("BUTTONSTATE"); } ! ! void calculate(int output_id, int count, Buffer &out) { ! try ! { ! RCPtr<MarieObject> dataPtr = getInput(m_commandInID,count); ! CommandJoystick *commandJoystick = dynamic_cast<CommandJoystick*>(dataPtr->getData()); ! if (commandJoystick != NULL) ! { ! int x, y, xmin, ymin, xmax, ymax, nbButtons, buttonState = 0; ! ! commandJoystick->getXY(x, y); ! commandJoystick->getMinXY(xmin, ymin); ! commandJoystick->getMaxXY(xmax, ymax); ! nbButtons = commandJoystick->getNbButtons(); ! buttonState = commandJoystick->getButtonState(); ! ! //output data ! (*outputs[m_xOutID].buffer)[count] = ObjectRef(Int::alloc(x)); ! (*outputs[m_yOutID].buffer)[count] = ObjectRef(Int::alloc(y)); ! (*outputs[m_xminOutID].buffer)[count] = ObjectRef(Int::alloc(xmin)); ! (*outputs[m_yminOutID].buffer)[count] = ObjectRef(Int::alloc(ymin)); ! (*outputs[m_xmaxOutID].buffer)[count] = ObjectRef(Int::alloc(xmax)); ! (*outputs[m_ymaxOutID].buffer)[count] = ObjectRef(Int::alloc(ymax)); ! (*outputs[m_nbButtonsOutID].buffer)[count] = ObjectRef(Int::alloc(nbButtons)); ! (*outputs[m_buttonStateOutID].buffer)[count] = ObjectRef(Int::alloc(buttonState)); ! } ! else // commandJoystick == NULL ! { ! std::cerr << "FD::extractMarieCommandJoystick -> MarieObject received data not of CommandJoystick type" << std::endl; ! out[count] = nilObject; ! } ! } ! catch (BaseException *e) ! { ! e->print(cerr); ! e->add(new GeneralException("Unable to process",__FILE__,__LINE__)); ! throw e; ! } } };//class extractMarieCommandJoystick }//namespace marie Index: MarieDataOdometry.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/MarieDataOdometry.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MarieDataOdometry.cpp 7 Sep 2005 21:12:48 -0000 1.8 --- MarieDataOdometry.cpp 12 Sep 2005 21:31:19 -0000 1.9 *************** *** 28,78 **** using namespace FD; ! namespace marie ! { ! using namespace std; ! ! DECLARE_TYPE2(DataOdometry::ID,MarieDataOdometry) ! ! MarieDataOdometry::MarieDataOdometry() ! { ! ! } ! ! MarieDataOdometry::MarieDataOdometry (const DataOdometry &data) ! :DataOdometry(data) ! { ! ! } ! ! void MarieDataOdometry::printOn(ostream &out) const ! { ! MarieXMLDataFactory factory; ! ! //writing XML data ! string value = factory.toString((DataOdometry) (*this)); ! ! out.write(value.c_str(), value.size()); ! } ! ! void MarieDataOdometry::readFrom(istream &in) ! { ! throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! } ! ! void MarieDataOdometry::copyDataAbstract(DataAbstract *data) ! { ! if (data) ! { ! DataOdometry *my_data = dynamic_cast<DataOdometry*>(data); ! if (my_data) ! { ! //((DataOdometry*)this)->operator=(*my_data); ! this->DataOdometry::operator=(*my_data); ! } ! else ! { ! throw new GeneralException(string("Unable to cast into DataOdometry Abstract : ") + data->getID(),__FILE__,__LINE__); ! } ! } ! } ! } --- 28,78 ---- using namespace FD; ! // namespace marie ! // { ! // using namespace std; ! // ! // DECLARE_TYPE2(DataOdometry::ID,MarieDataOdometry) ! // ! // MarieDataOdometry::MarieDataOdometry() ! // { ! // ! // } ! // ! // MarieDataOdometry::MarieDataOdometry (const DataOdometry &data) ! // :DataOdometry(data) ! // { ! // ! // } ! // ! // void MarieDataOdometry::printOn(ostream &out) const ! // { ! // MarieXMLDataFactory factory; ! // ! // //writing XML data ! // string value = factory.toString((DataOdometry) (*this)); ! // ! // out.write(value.c_str(), value.size()); ! // } ! // ! // void MarieDataOdometry::readFrom(istream &in) ! // { ! // throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! // } ! // ! // void MarieDataOdometry::copyDataAbstract(DataAbstract *data) ! // { ! // if (data) ! // { ! // DataOdometry *my_data = dynamic_cast<DataOdometry*>(data); ! // if (my_data) ! // { ! // //((DataOdometry*)this)->operator=(*my_data); ! // this->DataOdometry::operator=(*my_data); ! // } ! // else ! // { ! // throw new GeneralException(string("Unable to cast into DataOdometry Abstract : ") + data->getID(),__FILE__,__LINE__); ! // } ! // } ! // } ! // } Index: MarieDataRaw.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/MarieDataRaw.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MarieDataRaw.cpp 7 Sep 2005 21:12:48 -0000 1.8 --- MarieDataRaw.cpp 12 Sep 2005 21:31:19 -0000 1.9 *************** *** 29,79 **** using namespace FD; ! namespace marie ! { ! DECLARE_TYPE2(DataRaw::ID,MarieDataRaw) ! ! using namespace std; ! ! MarieDataRaw::MarieDataRaw() ! { ! ! } ! ! MarieDataRaw::MarieDataRaw (const DataRaw &data) ! :DataRaw(data) ! { ! ! } ! ! void MarieDataRaw::printOn(ostream &out) const ! { ! MarieXMLDataFactory factory; ! ! //writing XML data ! string value = factory.toString((DataRaw) (*this)); ! ! out.write(value.c_str(), value.size()); ! } ! ! void MarieDataRaw::readFrom(istream &in) ! { ! throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! } ! ! void MarieDataRaw::copyDataAbstract(DataAbstract *data) ! { ! if (data) ! { ! DataRaw *my_data = dynamic_cast<DataRaw*>(data); ! if (my_data) ! { ! //((DataRaw*)this)->operator=(*my_data); ! this->DataRaw::operator=(*my_data); ! } ! else ! { ! throw new GeneralException(string("Unable to cast into DataRaw Abstract : ") + data->getID(),__FILE__,__LINE__); ! } ! } ! } ! } --- 29,79 ---- using namespace FD; ! // namespace marie ! // { ! // DECLARE_TYPE2(DataRaw::ID,MarieDataRaw) ! // ! // using namespace std; ! // ! // MarieDataRaw::MarieDataRaw() ! // { ! // ! // } ! // ! // MarieDataRaw::MarieDataRaw (const DataRaw &data) ! // :DataRaw(data) ! // { ! // ! // } ! // ! // void MarieDataRaw::printOn(ostream &out) const ! // { ! // MarieXMLDataFactory factory; ! // ! // //writing XML data ! // string value = factory.toString((DataRaw) (*this)); ! // ! // out.write(value.c_str(), value.size()); ! // } ! // ! // void MarieDataRaw::readFrom(istream &in) ! // { ! // throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! // } ! // ! // void MarieDataRaw::copyDataAbstract(DataAbstract *data) ! // { ! // if (data) ! // { ! // DataRaw *my_data = dynamic_cast<DataRaw*>(data); ! // if (my_data) ! // { ! // //((DataRaw*)this)->operator=(*my_data); ! // this->DataRaw::operator=(*my_data); ! // } ! // else ! // { ! // throw new GeneralException(string("Unable to cast into DataRaw Abstract : ") + data->getID(),__FILE__,__LINE__); ! // } ! // } ! // } ! // } Index: MarieCommandJoystick.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/MarieCommandJoystick.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MarieCommandJoystick.cpp 7 Sep 2005 21:12:48 -0000 1.8 --- MarieCommandJoystick.cpp 12 Sep 2005 21:31:19 -0000 1.9 *************** *** 31,78 **** { using namespace std; ! ! DECLARE_TYPE2(CommandJoystick::ID,MarieCommandJoystick) ! ! MarieCommandJoystick::MarieCommandJoystick() ! { ! ! } ! ! MarieCommandJoystick::MarieCommandJoystick (const CommandJoystick &command) ! :CommandJoystick(command) ! { ! ! } ! ! void MarieCommandJoystick::printOn(ostream &out) const ! { ! MarieXMLDataFactory factory; ! ! //writing XML data ! string value = factory.toString((CommandJoystick) (*this)); ! ! out.write(value.c_str(), value.size()); ! } ! ! void MarieCommandJoystick::readFrom(istream &in) ! { ! throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! } ! ! void MarieCommandJoystick::copyDataAbstract(DataAbstract *data) ! { ! if (data) ! { ! CommandJoystick *command = dynamic_cast<CommandJoystick*>(data); ! if (command) ! { ! //((CommandJoystick*)this)->operator=(*command); ! this->CommandJoystick::operator=(*command); ! } ! else ! { ! throw new GeneralException(string("Unable to cast into CommandJoystick Abstract : ") + data->getID(),__FILE__,__LINE__); ! } ! } ! } } --- 31,78 ---- { using namespace std; ! // ! // DECLARE_TYPE2(CommandJoystick::ID,MarieCommandJoystick) ! // ! // MarieCommandJoystick::MarieCommandJoystick() ! // { ! // ! // } ! // ! // MarieCommandJoystick::MarieCommandJoystick (const CommandJoystick &command) ! // :CommandJoystick(command) ! // { ! // ! // } ! // ! // void MarieCommandJoystick::printOn(ostream &out) const ! // { ! // MarieXMLDataFactory factory; ! // ! // //writing XML data ! // string value = factory.toString((CommandJoystick) (*this)); ! // ! // out.write(value.c_str(), value.size()); ! // } ! // ! // void MarieCommandJoystick::readFrom(istream &in) ! // { ! // throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! // } ! // ! // void MarieCommandJoystick::copyDataAbstract(DataAbstract *data) ! // { ! // if (data) ! // { ! // CommandJoystick *command = dynamic_cast<CommandJoystick*>(data); ! // if (command) ! // { ! // //((CommandJoystick*)this)->operator=(*command); ! // this->CommandJoystick::operator=(*command); ! // } ! // else ! // { ! // throw new GeneralException(string("Unable to cast into CommandJoystick Abstract : ") + data->getID(),__FILE__,__LINE__); ! // } ! // } ! // } } Index: extractMarieDataOdometry.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/extractMarieDataOdometry.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** extractMarieDataOdometry.cpp 29 Mar 2005 15:20:43 -0000 1.3 --- extractMarieDataOdometry.cpp 12 Sep 2005 21:31:19 -0000 1.4 *************** *** 22,30 **** #include <sstream> #include <string> ! #include "MarieDataOdometry.h" ! #include "MarieXMLDataFactory.h" ! #include "Behavior.h" ! #include "Vector.h" ! #include "MarieDataNull.h" using namespace std; --- 22,28 ---- #include <sstream> #include <string> ! #include "BufferedNode.h" ! #include "MarieObject.h" ! #include "DataOdometry.h" using namespace std; *************** *** 33,54 **** namespace marie { ! //forward declaration ! class extractMarieDataOdometry; ! ! DECLARE_NODE(extractMarieDataOdometry) ! /*Node * * @name extractMarieDataOdometry * @category RobotFlow:MARIE:DATA ! * @description Extract data in the FlowDesigner format from MarieDataOdometry * * @input_name DATA_ODOMETRY ! * @input_type MarieDataOdometry ! * @input_description MarieDataOdometry object * * @output_name XPOS * @output_description X axis position * @output_type int ! * * @output_name YPOS * @output_description Y axis position --- 31,52 ---- namespace marie { ! //forward declaration ! class extractMarieDataOdometry; ! ! DECLARE_NODE(extractMarieDataOdometry) ! /*Node * * @name extractMarieDataOdometry * @category RobotFlow:MARIE:DATA ! * @description Extract data in the FlowDesigner format from MarieObject * * @input_name DATA_ODOMETRY ! * @input_type MarieObject ! * @input_description input MarieObject object containing a DataOdometry * * @output_name XPOS * @output_description X axis position * @output_type int ! * * @output_name YPOS * @output_description Y axis position *************** *** 60,70 **** * * @output_name YAW ! * @output_description YAW angle * @output_type int * * @output_name PITCH ! * @output_description PITCH angle * @output_type int ! * * @output_name ROLL * @output_description ROLL angle --- 58,68 ---- * * @output_name YAW ! * @output_description YAW angle * @output_type int * * @output_name PITCH ! * @output_description PITCH angle * @output_type int ! * * @output_name ROLL * @output_description ROLL angle *************** *** 74,78 **** * @output_description linear speed (X-Y) * @output_type int ! * * @output_name SIDE_SPEED * @output_description translational speed (X-Y) --- 72,76 ---- * @output_description linear speed (X-Y) * @output_type int ! * * @output_name SIDE_SPEED * @output_description translational speed (X-Y) *************** *** 82,162 **** * @output_description rotation speed (X-Y) * @output_type int ! * ! END*/ ! ! ! using namespace std; ! ! class extractMarieDataOdometry : public BufferedNode ! { ! ! private: ! //intputs ! int m_dataOdometryID; ! ! //outputs ! int m_XposID; ! int m_YposID; ! int m_ZposID; ! int m_yawID; ! int m_pitchID; ! int m_rollID; ! int m_linSpeedID; ! int m_sideSpeedID; ! int m_rotSpeedID; ! ! public: ! ! ! extractMarieDataOdometry(string nodeName, ParameterSet params) ! : BufferedNode(nodeName,params) ! { ! //inputs ! m_dataOdometryID = addInput("DATA_ODOMETRY"); ! //outputs ! m_XposID = addOutput("XPOS"); ! m_YposID = addOutput("YPOS"); ! m_ZposID = addOutput("ZPOS"); ! m_yawID = addOutput("YAW"); ! m_pitchID = addOutput("PITCH"); ! m_rollID = addOutput("ROLL"); ! m_linSpeedID = addOutput("LINEAR_SPEED"); ! m_sideSpeedID = addOutput("SIDE_SPEED"); ! m_rotSpeedID = addOutput("ROTATION_SPEED"); ! } ! ! void calculate(int output_id, int count, Buffer &out) ! { ! try { ! //get input ! RCPtr<MarieDataOdometry> data = getInput(m_dataOdometryID,count); ! ! ! int x,y,z,yaw,pitch,roll, linspeed, sidespeed,rotspeed; ! data->getPosition(x,y,z); ! data->getOrientation(yaw,pitch,roll); ! data->getSpeed(linspeed,sidespeed,rotspeed); ! ! //output data ! (*outputs[m_XposID].buffer)[count] = ObjectRef(Int::alloc(x)); ! (*outputs[m_YposID].buffer)[count] = ObjectRef(Int::alloc(y)); ! (*outputs[m_ZposID].buffer)[count] = ObjectRef(Int::alloc(z)); ! (*outputs[m_yawID].buffer)[count] = ObjectRef(Int::alloc(yaw)); ! (*outputs[m_pitchID].buffer)[count] = ObjectRef(Int::alloc(pitch)); ! (*outputs[m_rollID].buffer)[count] = ObjectRef(Int::alloc(roll)); ! (*outputs[m_linSpeedID].buffer)[count] = ObjectRef(Int::alloc(linspeed)); ! (*outputs[m_sideSpeedID].buffer)[count] = ObjectRef(Int::alloc(sidespeed)); ! (*outputs[m_rotSpeedID].buffer)[count] = ObjectRef(Int::alloc(rotspeed)); } ! catch (BaseException *e) { ! e->print(cerr); ! e->add(new GeneralException("Unable to process",__FILE__,__LINE__)); ! throw e; } ! } ! };//class extractMarieDataOdometry }//namespace marie --- 80,166 ---- * @output_description rotation speed (X-Y) * @output_type int ! * ! END*/ ! ! using namespace std; ! ! class extractMarieDataOdometry : public BufferedNode ! { ! ! private: ! //intputs ! int m_dataOdometryID; ! //outputs ! int m_XposID; ! int m_YposID; ! int m_ZposID; ! int m_yawID; ! int m_pitchID; ! int m_rollID; ! int m_linSpeedID; ! int m_sideSpeedID; ! int m_rotSpeedID; ! ! public: ! ! extractMarieDataOdometry(string nodeName, ParameterSet params) ! : BufferedNode(nodeName,params) { ! //inputs ! m_dataOdometryID = addInput("DATA_ODOMETRY"); ! ! //outputs ! m_XposID = addOutput("XPOS"); ! m_YposID = addOutput("YPOS"); ! m_ZposID = addOutput("ZPOS"); ! m_yawID = addOutput("YAW"); ! m_pitchID = addOutput("PITCH"); ! m_rollID = addOutput("ROLL"); ! m_linSpeedID = addOutput("LINEAR_SPEED"); ! m_sideSpeedID = addOutput("SIDE_SPEED"); ! m_rotSpeedID = addOutput("ROTATION_SPEED"); } ! ! void calculate(int output_id, int count, Buffer &out) { ! try ! { ! //get input ! RCPtr<MarieObject> dataPtr = getInput(m_dataOdometryID,count); ! DataOdometry *dataOdometry = dynamic_cast<DataOdometry*>(dataPtr->getData()); ! if (dataOdometry != NULL) ! { ! ! int x,y,z,yaw,pitch,roll, linspeed, sidespeed,rotspeed; ! dataOdometry->getPosition(x,y,z); ! dataOdometry->getOrientation(yaw,pitch,roll); ! dataOdometry->getSpeed(linspeed,sidespeed,rotspeed); ! ! //output data ! (*outputs[m_XposID].buffer)[count] = ObjectRef(Int::alloc(x)); ! (*outputs[m_YposID].buffer)[count] = ObjectRef(Int::alloc(y)); ! (*outputs[m_ZposID].buffer)[count] = ObjectRef(Int::alloc(z)); ! (*outputs[m_yawID].buffer)[count] = ObjectRef(Int::alloc(yaw)); ! (*outputs[m_pitchID].buffer)[count] = ObjectRef(Int::alloc(pitch)); ! (*outputs[m_rollID].buffer)[count] = ObjectRef(Int::alloc(roll)); ! (*outputs[m_linSpeedID].buffer)[count] = ObjectRef(Int::alloc(linspeed)); ! (*outputs[m_sideSpeedID].buffer)[count] = ObjectRef(Int::alloc(sidespeed)); ! (*outputs[m_rotSpeedID].buffer)[count] = ObjectRef(Int::alloc(rotspeed)); ! } ! else ! { ! std::cerr << "FD::extractMarieDataOdometry -> MarieObject received data not of DataOdometry type" << std::endl; ! out[count] = nilObject; ! } ! } ! catch (BaseException *e) ! { ! e->print(cerr); ! e->add(new GeneralException("Unable to process",__FILE__,__LINE__)); ! throw e; ! } } ! };//class extractMarieDataOdometry }//namespace marie Index: extractMarieDataCamera.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/extractMarieDataCamera.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** extractMarieDataCamera.cpp 29 Mar 2005 15:20:43 -0000 1.3 --- extractMarieDataCamera.cpp 12 Sep 2005 21:31:19 -0000 1.4 *************** *** 22,30 **** #include <sstream> #include <string> ! #include "MarieDataCamera.h" ! #include "MarieXMLDataFactory.h" ! #include "Behavior.h" ! #include "Vector.h" ! #include "MarieDataNull.h" using namespace std; --- 22,28 ---- #include <sstream> #include <string> ! #include "BufferedNode.h" ! #include "MarieObject.h" ! #include "DataCamera.h" using namespace std; *************** *** 33,49 **** namespace marie { ! //forward declaration ! class extractMarieDataCamera; ! ! DECLARE_NODE(extractMarieDataCamera) ! /*Node * * @name extractMarieDataCamera * @category RobotFlow:MARIE:DATA ! * @description Extract data in the FlowDesigner format from MarieDataCamera * * @input_name DATA_CAMERA ! * @input_type MarieDataCamera ! * @input_description MarieDataCamera object * * @output_name PAN --- 31,47 ---- namespace marie { ! //forward declaration ! class extractMarieDataCamera; ! ! DECLARE_NODE(extractMarieDataCamera) ! /*Node * * @name extractMarieDataCamera * @category RobotFlow:MARIE:DATA ! * @description Extract data in the FlowDesigner format from MarieObject * * @input_name DATA_CAMERA ! * @input_type MarieObject ! * @input_description input MarieObject object containing a DataCamera * * @output_name PAN *************** *** 75,151 **** * @output_type Image * ! END*/ ! ! ! using namespace std; ! ! class extractMarieDataCamera : public BufferedNode ! { ! ! private: ! ! //inputs ! int m_inputID; ! ! //outputs ! int m_panID; ! int m_tiltID; ! int m_zoomID; ! int m_imageWidthID; ! int m_imageHeightID; ! int m_imageID; ! int m_imageFormatID; ! ! public: ! ! ! extractMarieDataCamera(string nodeName, ParameterSet params) ! : BufferedNode(nodeName,params) ! { //inputs ! m_inputID = addInput("DATA_CAMERA"); //outputs ! m_panID = addOutput("PAN"); ! m_tiltID = addOutput("TILT"); ! m_zoomID = addOutput("ZOOM"); ! m_imageWidthID = addOutput("IMAGE_WIDTH"); ! m_imageHeightID = addOutput("IMAGE_HEIGHT"); ! m_imageID = addOutput("IMAGE"); ! m_imageFormatID = addOutput("IMAGE_FORMAT"); ! } ! ! void calculate(int output_id, int count, Buffer &out) ! { ! try ! { ! RCPtr<MarieDataCamera> dataCameraObject = getInput(m_inputID,count); ! ! int pan, tilt, zoom; ! dataCameraObject->getPTZ(pan,tilt,zoom); ! unsigned int width,height; ! dataCameraObject->getImageSize(width,height); ! ! (*outputs[m_panID].buffer)[count] = ObjectRef(Int::alloc(pan)); ! (*outputs[m_tiltID].buffer)[count] = ObjectRef(Int::alloc(tilt)); ! (*outputs[m_zoomID].buffer)[count] = ObjectRef(Int::alloc(zoom)); ! ! (*outputs[m_imageWidthID].buffer)[count] = ObjectRef(Int::alloc(width)); ! (*outputs[m_imageHeightID].buffer)[count] = ObjectRef(Int::alloc(height)); ! ! (*outputs[m_imageFormatID].buffer)[count] = ObjectRef(new String(dataCameraObject->getImageFormat())); ! ! //TODO output image ! (*outputs[m_imageID].buffer)[count] = nilObject; } ! catch (BaseException *e) { ! e->print(cerr); ! e->add(new GeneralException("Unable to process",__FILE__,__LINE__)); ! throw e; } ! } ! };//class extractMarieDataCamera }//namespace marie - --- 73,154 ---- * @output_type Image * ! END*/ ! ! using namespace std; ! ! class extractMarieDataCamera : public BufferedNode ! { ! ! private: ! //inputs ! int m_inputID; //outputs ! int m_panID; ! int m_tiltID; ! int m_zoomID; ! int m_imageWidthID; ! int m_imageHeightID; ! int m_imageID; ! int m_imageFormatID; ! ! public: ! ! extractMarieDataCamera(string nodeName, ParameterSet params) ! : BufferedNode(nodeName,params) ! { ! //inputs ! m_inputID = addInput("DATA_CAMERA"); ! //outputs ! m_panID = addOutput("PAN"); ! m_tiltID = addOutput("TILT"); ! m_zoomID = addOutput("ZOOM"); ! m_imageWidthID = addOutput("IMAGE_WIDTH"); ! m_imageHeightID = addOutput("IMAGE_HEIGHT"); ! m_imageID = addOutput("IMAGE"); ! m_imageFormatID = addOutput("IMAGE_FORMAT"); } ! ! void calculate(int output_id, int count, Buffer &out) { ! try ! { ! RCPtr<MarieObject> dataPtr = getInput(m_inputID,count); ! DataCamera *dataCamera = dynamic_cast<DataCamera*>(dataPtr->getData()); ! if (dataCamera != NULL) ! { ! int pan, tilt, zoom; ! dataCamera->getPTZ(pan,tilt,zoom); ! ! unsigned int width,height; ! dataCamera->getImageSize(width,height); ! ! (*outputs[m_panID].buffer)[count] = ObjectRef(Int::alloc(pan)); ! (*outputs[m_tiltID].buffer)[count] = ObjectRef(Int::alloc(tilt)); ! (*outputs[m_zoomID].buffer)[count] = ObjectRef(Int::alloc(zoom)); ! ! (*outputs[m_imageWidthID].buffer)[count] = ObjectRef(Int::alloc(width)); ! (*outputs[m_imageHeightID].buffer)[count] = ObjectRef(Int::alloc(height)); ! ! (*outputs[m_imageFormatID].buffer)[count] = ObjectRef(new String(dataCamera->getImageFormat())); ! ! //TODO output image ! (*outputs[m_imageID].buffer)[count] = nilObject; ! } ! else ! { ! std::cerr << "FD::extractMarieDataCamera -> MarieObject received data not of DataCamera type" << std::endl; ! out[count] = nilObject; ! } ! } ! catch (BaseException *e) ! { ! e->print(cerr); ! e->add(new GeneralException("Unable to process",__FILE__,__LINE__)); ! throw e; ! } } ! };//class extractMarieDataCamera }//namespace marie Index: newMarieDataBumper.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/newMarieDataBumper.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** newMarieDataBumper.cpp 29 Mar 2005 15:20:43 -0000 1.3 --- newMarieDataBumper.cpp 12 Sep 2005 21:31:19 -0000 1.4 *************** *** 22,30 **** #include <sstream> #include <string> ! #include "MarieDataBumper.h" ! #include "MarieXMLDataFactory.h" ! #include "Behavior.h" ! #include "Vector.h" ! #include "MarieDataNull.h" using namespace std; --- 22,28 ---- #include <sstream> #include <string> ! #include "BufferedNode.h" ! #include "MarieObject.h" ! #include "DataBumper.h" using namespace std; *************** *** 33,111 **** namespace marie { ! //forward declaration ! class newMarieDataBumper; ! ! DECLARE_NODE(newMarieDataBumper) ! /*Node * * @name newMarieDataBumper * @category RobotFlow:MARIE:DATA ! * @description Create an object of type MarieDataBumper * * @input_name NBBUMPERS ! * @input_type int * @input_description input nb buttons, nilObject if not used * * @input_name BUMPERSTATE * @input_type int ! * @input_description input bumper state, nilObject if not used * * @output_name DATA_BUMPER ! * @output_type MarieDataBumper ! * @output_description Output DataBumper * ! END*/ ! ! ! using namespace std; ! ! class newMarieDataBumper : public BufferedNode ! { ! ! private: ! //inputs ! int m_nbBumpersInID; ! int m_bumperStateInID; ! ! //outputs ! int m_dataBumperOutID; ! ! public: ! ! ! newMarieDataBumper(string nodeName, ParameterSet params) ! : BufferedNode(nodeName,params) ! { //inputs ! m_nbBumpersInID = addInput("NBBUMPERS"); ! m_bumperStateInID = addInput("BUMPERSTATE"); //outputs ! m_dataBumperOutID = addOutput("DATA_BUMPER"); ! } ! ! void calculate(int output_id, int count, Buffer &out) ! { ! try ! { ! RCPtr<Int> nbBumpers = getInput(m_nbBumpersInID,count); ! RCPtr<Int> bumperState = getInput(m_bumperStateInID,count); ! MarieDataBumper *data = new MarieDataBumper(); ! ! //set the data ! data->setNbBumpers(*nbBumpers); ! data->setBumperState(*bumperState); ! ! //output object ! out[count] = ObjectRef(data); } ! catch (BaseException *e) { ! e->print(cerr); ! e->add(new GeneralException("Unable to process",__FILE__,__LINE__)); ! throw e; } ! } ! };//class newMarieDataBumper }//namespace marie - --- 31,106 ---- namespace marie { ! //forward declaration ! class newMarieDataBumper; ! ! DECLARE_NODE(newMarieDataBumper) ! /*Node * * @name newMarieDataBumper * @category RobotFlow:MARIE:DATA ! * @description Create an object of type MarieObject containing a DataBumper data * * @input_name NBBUMPERS ! * @input_type int * @input_description input nb buttons, nilObject if not used * * @input_name BUMPERSTATE * @input_type int ! * @input_description input bumper state, nilObject if not used * * @output_name DATA_BUMPER ! * @output_description Output MarieObject containing a DataBumper data ! * @output_type MarieObject * ! END*/ ! ! using namespace std; ! ! class newMarieDataBumper : public BufferedNode ! { ! ! private: //inputs ! int m_nbBumpersInID; ! int m_bumperStateInID; //outputs ! int m_dataBumperOutID; ! ! public: ! ! newMarieDataBumper(string nodeName, ParameterSet params) ! : BufferedNode(nodeName,params) ! { ! //inputs ! m_nbBumpersInID = addInput("NBBUMPERS"); ! m_bumperStateInID = addInput("BUMPERSTATE"); ! ! //outputs ! m_dataBumperOutID = addOutput("DATA_BUMPER"); } ! ! void calculate(int output_id, int count, Buffer &out) { ! try ! { ! RCPtr<Int> nbBumpers = getInput(m_nbBumpersInID,count); ! RCPtr<Int> bumperState = getInput(m_bumperStateInID,count); ! DataBumper *data = new DataBumper(); ! ! //set the data ! data->setNbBumpers(*nbBumpers); ! data->setBumperState(*bumperState); ! ! //output object ! out[count] = ObjectRef(new MarieObject(data)); ! } ! catch (BaseException *e) ! { ! e->print(cerr); ! e->add(new GeneralException("Unable to process",__FILE__,__LINE__)); ! throw e; ! } } ! };//class newMarieDataBumper }//namespace marie Index: MariePush.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/MariePush.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MariePush.cpp 29 Mar 2005 15:20:42 -0000 1.3 --- MariePush.cpp 12 Sep 2005 21:31:19 -0000 1.4 *************** *** 25,28 **** --- 25,29 ---- #include "operators.h" #include <sstream> + #include "MarieObject.h" #include "MarieXMLDataFactory.h" *************** *** 70,87 **** ObjectRef val = getInput(m_inputID,count); RCPtr<OStream> my_stream = ... [truncated message content] |