Update of /cvsroot/robotflow/RobotFlow/MARIE/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19723/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 MarieDataNull.cpp MarieDataOdometry.cpp MarieDataRaw.cpp MarieDataSonar.cpp MarieRequestSystem.cpp extractMarieRequestSystem.cpp newMarieCommandBehavior.cpp newMarieCommandCamera.cpp newMarieDataMap.cpp newMarieRequestSystem.cpp Log Message: remove useless inheritance of BuffuredNode by MarieObject Index: MarieDataCamera.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/MarieDataCamera.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MarieDataCamera.cpp 22 Aug 2005 21:21:07 -0000 1.7 --- MarieDataCamera.cpp 7 Sep 2005 21:12:48 -0000 1.8 *************** *** 30,178 **** namespace marie { ! DECLARE_NODE(MarieDataCamera) ! /*Node ! * ! * @name MarieDataCamera ! * @category RobotFlow:MARIE:zdeprecated ! * @description Save an object ! * ! * @input_name DATA_CAMERA ! * @input_type MarieDataCamera ! * @input_description MarieDataCamera Object ! * ! * @output_name PAN ! * @output_description Pan of the camera ! * @output_type int ! * ! * @output_name TILT ! * @output_description Tilt of the camera ! * @output_type int ! * ! * @output_name ZOOM ! * @output_description Zoom of the camera ! * @output_type int ! * ! * @output_name IMAGE_WIDTH ! * @output_description image width from the camera ! * @output_type int ! * ! * @output_name IMAGE_HEIGHT ! * @output_description image height from the camera ! * @output_type int ! * ! * @output_name IMAGE_FORMAT ! * @output_description format of the image ! * @output_type string ! * ! * @output_name IMAGE ! * @output_description the image data ! * @output_type Image ! * ! END*/ ! ! DECLARE_TYPE2(DataCamera::ID,MarieDataCamera) ! ! using namespace std; ! ! MarieDataCamera::MarieDataCamera() ! : MarieObject("MarieDataCamera",ParameterSet()), m_isNode(false) ! { ! ! } ! ! MarieDataCamera::MarieDataCamera (const DataCamera &data) ! : MarieObject("MarieDataCamera",ParameterSet()), DataCamera(data), ! m_isNode(false) ! { ! } ! ! MarieDataCamera::MarieDataCamera(string nodeName, ParameterSet params) ! : MarieObject(nodeName,params), m_isNode(true) ! { ! //used as a BufferedNode, create inputs & outputs ! ! //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 MarieDataCamera::calculate(int output_id, int count, Buffer &out) ! { ! ! ObjectRef InputValue = getInput(m_inputID,count); ! if (m_isNode && !InputValue->isNil()) ! { ! RCPtr<MarieDataCamera> dataCameraObject = InputValue; ! ! 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; ! } ! else ! { ! out[count] = nilObject; ! } ! } ! ! 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: MarieDataMap.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/MarieDataMap.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** MarieDataMap.cpp 22 Aug 2005 21:21:07 -0000 1.6 --- MarieDataMap.cpp 7 Sep 2005 21:12:48 -0000 1.7 *************** *** 31,156 **** namespace marie { ! DECLARE_NODE(MarieDataMap) ! /*Node ! * ! * @name MarieDataMap ! * @category RobotFlow:MARIE:zdeprecated ! * @description Read MARIE data maps ! * ! * @input_name DATA_MAP ! * @input_type MarieDataMap ! * @input_description MarieDataMap Object ! * ! * @output_name COMPOSITE ! * @output_description FlowDesigner CompositeType object (equivalent to DataMap) ! * @output_type CompositeType ! * ! END*/ ! ! DECLARE_TYPE2(DataAssociativeMap::ID,MarieDataMap) ! ! using namespace std; ! ! MarieDataMap::MarieDataMap() ! : MarieObject("MarieDataMap",ParameterSet()), m_isNode(false) ! { ! ! } ! ! MarieDataMap::MarieDataMap (const DataAssociativeMap &data) ! : MarieObject("MarieDataMap",ParameterSet()), DataAssociativeMap(data), ! m_isNode(false) ! { ! } ! ! MarieDataMap::MarieDataMap(string nodeName, ParameterSet params) ! : MarieObject(nodeName,params), m_isNode(true) ! { ! //used as a BufferedNode, create inputs & outputs ! ! //inputs ! m_inputID = addInput("DATA_MAP"); ! ! //outputs ! m_outputID = addOutput("COMPOSITE"); ! ! } ! ! void MarieDataMap::calculate(int output_id, int count, Buffer &out) ! { ! ! ObjectRef InputValue = getInput(m_inputID,count); ! if (m_isNode && !InputValue->isNil()) ! { ! RCPtr<MarieDataMap> dataMapObject = InputValue; ! ! const std::map<std::string, std::string> my_map = dataMapObject->getValues(); ! ! CompositeType *cType = new CompositeType(); ! ! for (map<string,string>::const_iterator iter = my_map.begin(); ! iter != my_map.end(); iter++) { ! ! stringstream key((*iter).first); ! stringstream value((*iter).second); ! ! try { ! //try to read FlowDesigner object ! ObjectRef ObjectValue; ! ! value >> ObjectValue; ! ! cType->addField(key.str(), ObjectValue); ! } ! catch(...) { ! //unable to read FlowDesigner Object ! //output standard string ! ObjectRef ObjectValue(new String(value.str())); ! cType->addField(key.str(),ObjectValue); ! } ! } ! ! //output Composite type ! out[count] = ObjectRef(cType); ! } ! else ! { ! out[count] = nilObject; ! } ! } ! ! void MarieDataMap::printOn(ostream &out) const ! { ! MarieXMLDataFactory factory; ! ! //writing XML data ! string value = factory.toString((DataAssociativeMap) (*this)); ! ! out.write(value.c_str(), value.size()); ! ! } ! ! ! void MarieDataMap::readFrom(istream &in) ! { ! throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! } ! ! void MarieDataMap::copyDataAbstract(DataAbstract *data) ! { ! if (data) ! { ! DataAssociativeMap *my_data = dynamic_cast<DataAssociativeMap*>(data); ! if (my_data) ! { ! this->DataAssociativeMap::operator=(*my_data); ! } ! else ! { ! throw new GeneralException(string("Unable to cast into DataAssociativeMap Abstract : ") + data->getID(),__FILE__,__LINE__); ! } ! } ! } } --- 31,78 ---- namespace marie { ! DECLARE_TYPE2(DataAssociativeMap::ID,MarieDataMap) ! using namespace std; ! ! MarieDataMap::MarieDataMap() ! { ! } ! ! MarieDataMap::MarieDataMap (const DataAssociativeMap &data) ! :DataAssociativeMap(data) ! { ! ! } ! ! void MarieDataMap::printOn(ostream &out) const ! { ! MarieXMLDataFactory factory; ! ! //writing XML data ! string value = factory.toString((DataAssociativeMap) (*this)); ! ! out.write(value.c_str(), value.size()); ! } ! ! void MarieDataMap::readFrom(istream &in) ! { ! throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! } ! ! void MarieDataMap::copyDataAbstract(DataAbstract *data) ! { ! if (data) ! { ! DataAssociativeMap *my_data = dynamic_cast<DataAssociativeMap*>(data); ! if (my_data) ! { ! this->DataAssociativeMap::operator=(*my_data); ! } ! else ! { ! throw new GeneralException(string("Unable to cast into DataAssociativeMap Abstract : ") + data->getID(),__FILE__,__LINE__); ! } ! } ! } } Index: Makefile.am =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/Makefile.am,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Makefile.am 27 Jun 2005 17:43:20 -0000 1.25 --- Makefile.am 7 Sep 2005 21:12:48 -0000 1.26 *************** *** 9,14 **** lib_LTLIBRARIES = libRFMarie.la ! libRFMarie_la_SOURCES = MarieLoad.cpp \ ! MarieSave.cpp \ MariePull.cpp \ MariePush.cpp \ --- 9,13 ---- lib_LTLIBRARIES = libRFMarie.la ! libRFMarie_la_SOURCES = \ MariePull.cpp \ MariePush.cpp \ Index: newMarieCommandCamera.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/newMarieCommandCamera.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** newMarieCommandCamera.cpp 28 Jun 2005 20:40:32 -0000 1.5 --- newMarieCommandCamera.cpp 7 Sep 2005 21:12:48 -0000 1.6 *************** *** 20,23 **** --- 20,24 ---- */ #include "MarieCommandCamera.h" + #include "BufferedNode.h" #include "MarieDataNull.h" #include <sstream> Index: MarieDataIR.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/MarieDataIR.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MarieDataIR.cpp 22 Aug 2005 21:21:07 -0000 1.5 --- MarieDataIR.cpp 7 Sep 2005 21:12:48 -0000 1.6 *************** *** 31,140 **** namespace marie { ! DECLARE_NODE(MarieDataIR) ! /*Node ! * ! * @name MarieDataIR ! * @category RobotFlow:MARIE:zdeprecated ! * @description Save an object ! * ! * @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*/ ! ! DECLARE_TYPE2(DataIR::ID,MarieDataIR) ! ! using namespace std; ! ! MarieDataIR::MarieDataIR() ! : MarieObject("MarieDataIR",ParameterSet()), m_isNode(false) ! { ! ! } ! ! MarieDataIR::MarieDataIR (const DataIR &data) ! : MarieObject("MarieDataIR",ParameterSet()), DataIR(data), ! m_isNode(false) ! { ! ! } ! ! MarieDataIR::MarieDataIR(string nodeName, ParameterSet params) ! : MarieObject(nodeName,params), m_isNode(true) ! { ! //used as a BufferedNode, create inputs & outputs ! m_inputID = addInput("DATA_IR"); ! m_outputID = addOutput("RANGES"); ! } ! ! void MarieDataIR::calculate(int output_id, int count, Buffer &out) ! { ! ! ObjectRef InputValue = getInput(m_inputID,count); ! ! if (m_isNode && !InputValue->isNil()) ! { ! RCPtr<MarieDataIR> dataIRObject = InputValue; ! ! unsigned int size = dataIRObject->getNbIR(); ! const unsigned int *ranges = dataIRObject->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 ! { ! out[count] = nilObject; ! } ! } ! ! void MarieDataIR::printOn(ostream &out) const ! { ! MarieXMLDataFactory factory; ! ! //writing XML data ! string value = factory.toString((DataIR) (*this)); ! ! out.write(value.c_str(), value.size()); ! ! } ! ! ! void MarieDataIR::readFrom(istream &in) ! { ! throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! } ! ! void MarieDataIR::copyDataAbstract(DataAbstract *data) ! { ! ! if (data) ! { ! DataIR *my_data = dynamic_cast<DataIR*>(data); ! if (my_data) ! { ! //((DataIR*)this)->operator=(*my_data); ! this->DataIR::operator=(*my_data); ! } ! else ! { ! throw new GeneralException(string("Unable to cast into DataIR Abstract : ") + data->getID(),__FILE__,__LINE__); ! } ! } ! ! } } --- 31,80 ---- namespace marie { ! DECLARE_TYPE2(DataIR::ID,MarieDataIR) ! ! using namespace std; ! ! MarieDataIR::MarieDataIR() ! { ! } ! ! MarieDataIR::MarieDataIR (const DataIR &data) ! :DataIR(data) ! { ! ! } ! ! void MarieDataIR::printOn(ostream &out) const ! { ! MarieXMLDataFactory factory; ! ! //writing XML data ! string value = factory.toString((DataIR) (*this)); ! ! out.write(value.c_str(), value.size()); ! } ! ! ! void MarieDataIR::readFrom(istream &in) ! { ! throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! } ! ! void MarieDataIR::copyDataAbstract(DataAbstract *data) ! { ! if (data) ! { ! DataIR *my_data = dynamic_cast<DataIR*>(data); ! if (my_data) ! { ! //((DataIR*)this)->operator=(*my_data); ! this->DataIR::operator=(*my_data); ! } ! else ! { ! throw new GeneralException(string("Unable to cast into DataIR Abstract : ") + data->getID(),__FILE__,__LINE__); ! } ! } ! } } Index: newMarieRequestSystem.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/newMarieRequestSystem.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** newMarieRequestSystem.cpp 29 Mar 2005 15:20:43 -0000 1.6 --- newMarieRequestSystem.cpp 7 Sep 2005 21:12:48 -0000 1.7 *************** *** 20,23 **** --- 20,24 ---- */ #include "MarieRequestSystem.h" + #include "BufferedNode.h" #include <sstream> #include <string> Index: MarieCommandCamera.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/MarieCommandCamera.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** MarieCommandCamera.cpp 22 Aug 2005 21:35:01 -0000 1.11 --- MarieCommandCamera.cpp 7 Sep 2005 21:12:48 -0000 1.12 *************** *** 31,439 **** namespace marie { ! DECLARE_NODE(MarieCommandCamera) ! /*Node ! * ! * @name MarieCommandCamera ! * @category RobotFlow:MARIE:zdeprecated ! * @description Read & Create MarieCommandCamera data object ! * ! * @input_name COMMAND_CAMERA ! * @input_type Input MarieCommandCamera ! * @input_description input CommandCamera, nilObject if not used ! * ! * @input_name REL_BRIGHTNESS ! * @input_type int ! * @input_description input brightness, nilObject if not used ! * ! * @input_name REL_CONTRAST ! * @input_type int ! * @input_description input contrast, nilObject if not used ! * ! * @input_name REL_PAN ! * @input_type int ! * @input_description input pan, nilObject if not used ! * ! * @input_name REL_TILT ! * @input_type int ! * @input_description input tilt, nilObject if not used ! * ! * @input_name REL_ZOOM ! * @input_type int ! * @input_description input zoom, nilObject if not used ! * ! * @input_name ABS_BRIGHTNESS ! * @input_type int ! * @input_description input brightness, nilObject if not used ! * ! * @input_name ABS_CONTRAST ! * @input_type int ! * @input_description input contrast, nilObject if not used ! * ! * @input_name ABS_PAN ! * @input_type int ! * @input_description input pan, nilObject if not used ! * ! * @input_name ABS_TILT ! * @input_type int ! * @input_description input tilt, nilObject if not used ! * ! * @input_name ABS_ZOOM ! * @input_type int ! * @input_description input zoom, nilObject if not used ! * ! * @output_name COMMAND_CAMERA ! * @output_type MarieCommandCamera ! * @output_description Output CommandCamera (with new pan,tilt,zoom, brightness, contrast) ! * ! * @output_name REL_BRIGHTNESS ! * @output_type int ! * @output_description output brightness ! * ! * @output_name REL_CONTRAST ! * @output_type int ! * @output_description output contrast ! * ! * @output_name REL_PAN ! * @output_type int ! * @output_description output pan ! * ! * @output_name REL_TILT ! * @output_type int ! * @output_description output tilt ! * ! * @output_name REL_ZOOM ! * @output_type int ! * @output_description output zoom ! * ! * @output_name ABS_BRIGHTNESS ! * @output_type int ! * @output_description output brightness ! * ! * @output_name ABS_CONTRAST ! * @output_type int ! * @output_description output contrast ! * ! * @output_name ABS_PAN ! * @output_type int ! * @output_description output pan ! * ! * @output_name ABS_TILT ! * @output_type int ! * @output_description output tilt ! * ! * @output_name ABS_ZOOM ! * @output_type int ! * @output_description output zoom ! * ! END*/ ! ! ! using namespace std; ! ! DECLARE_TYPE2(CommandCamera::ID,MarieCommandCamera) ! ! MarieCommandCamera::MarieCommandCamera() ! : MarieObject("MarieCommandCamera",ParameterSet()), m_isNode(false) ! { ! ! } ! ! MarieCommandCamera::MarieCommandCamera (const CommandCamera &command) ! : MarieObject("MarieCommandCamera",ParameterSet()), CommandCamera(command), ! m_isNode(false) ! { ! ! } ! ! MarieCommandCamera::MarieCommandCamera(string nodeName, ParameterSet params) ! : MarieObject(nodeName,params), m_isNode(true) ! { ! //used as a BufferedNode, create inputs & outputs ! ! //inputs ! m_commandInID = addInput("COMMAND_CAMERA"); ! m_relBrightnessInID = addInput("REL_BRIGHTNESS"); ! m_relContrastInID = addInput("REL_CONTRAST"); ! m_relPanInID = addInput("REL_PAN"); ! m_relTiltInID = addInput("REL_TILT"); ! m_relZoomInID = addInput("REL_ZOOM"); ! ! m_absBrightnessInID = addInput("ABS_BRIGHTNESS"); ! m_absContrastInID = addInput("ABS_CONTRAST"); ! m_absPanInID = addInput("ABS_PAN"); ! m_absTiltInID = addInput("ABS_TILT"); ! m_absZoomInID = addInput("ABS_ZOOM"); ! ! //outputs ! m_commandOutID = addOutput("COMMAND_CAMERA"); ! m_relBrightnessOutID = addOutput("REL_BRIGHTNESS"); ! m_relContrastOutID = addOutput("REL_CONTRAST"); ! m_relPanOutID = addOutput("REL_PAN"); ! m_relTiltOutID = addOutput("REL_TILT"); ! m_relZoomOutID = addOutput("REL_ZOOM"); ! ! m_absBrightnessOutID = addOutput("ABS_BRIGHTNESS"); ! m_absContrastOutID = addOutput("ABS_CONTRAST"); ! m_absPanOutID = addOutput("ABS_PAN"); ! m_absTiltOutID = addOutput("ABS_TILT"); ! m_absZoomOutID = addOutput("ABS_ZOOM"); ! } ! ! void MarieCommandCamera::calculate(int output_id, int count, Buffer &out) ! { ! if (m_isNode) ! { ! MarieCommandCamera *command = NULL; ! int relPan = 0; ! int relTilt = 0; ! int relZoom = 0; ! int relContrast = 0; ! int relBrightness = 0; ! int absPan = 0; ! int absTilt = 0; ! int absZoom = 0; ! int absContrast = 0; ! int absBrightness = 0; ! ! std::bitset<10> state; ! ! //get all inputs ! ObjectRef commandInValue = getInput(m_commandInID,count); ! ObjectRef relBrightnessInValue = getInput(m_relBrightnessInID,count); ! ObjectRef relContrastInValue = getInput(m_relContrastInID,count); ! ObjectRef relPanInValue = getInput(m_relPanInID,count); ! ObjectRef relTiltInValue = getInput(m_relTiltInID,count); ! ObjectRef relZoomInValue = getInput(m_relZoomInID,count); ! ObjectRef absBrightnessInValue = getInput(m_absBrightnessInID,count); ! ObjectRef absContrastInValue = getInput(m_absContrastInID,count); ! ObjectRef absPanInValue = getInput(m_absPanInID,count); ! ObjectRef absTiltInValue = getInput(m_absTiltInID,count); ! ObjectRef absZoomInValue = getInput(m_absZoomInID,count); ! //create command object ! if (!commandInValue->isNil()) { ! RCPtr<MarieCommandCamera> inputCommand = commandInValue; ! //copy input command ! command = new MarieCommandCamera(*inputCommand); ! ! relPan = command->getRelativePan(); ! relTilt = command->getRelativeTilt(); ! relZoom = command->getRelativeZoom(); ! relContrast = command->getRelativeContrast(); ! relBrightness = command->getRelativeBrightness(); ! ! absPan = command->getAbsolutePan(); ! absTilt = command->getAbsoluteTilt(); ! absZoom = command->getAbsoluteZoom(); ! absContrast = command->getAbsoluteContrast(); ! absBrightness = command->getAbsoluteBrightness(); ! } else { ! if (!relBrightnessInValue->isNil() || !relContrastInValue->isNil() || ! !relPanInValue->isNil() || !relTiltInValue->isNil() || !relZoomInValue->isNil() || ! !absBrightnessInValue->isNil() || !absContrastInValue->isNil() || ! !absPanInValue->isNil() || !absTiltInValue->isNil() || !absZoomInValue->isNil()) ! ! ! { ! command = new MarieCommandCamera(); ! ! //get pan ! if (!relPanInValue->isNil()) ! { ! RCPtr<Int> relPanPtr = relPanInValue; ! relPan = *relPanPtr; ! command->setRelativePan(relPan); ! } ! //get tilt ! if (!relTiltInValue->isNil()) ! { ! RCPtr<Int> relTiltPtr = relTiltInValue; ! relTilt = *relTiltPtr; ! command->setRelativeTilt(relTilt); ! } ! //get zoom ! if (!relZoomInValue->isNil()) ! { ! RCPtr<Int> relZoomPtr = relZoomInValue; ! relZoom = *relZoomPtr; ! command->setRelativeZoom(relZoom); ! } ! //get contrast ! if (!relContrastInValue->isNil()) ! { ! RCPtr<Int> relContrastPtr = relContrastInValue; ! relContrast = *relContrastPtr; ! command->setRelativeContrast(relContrast); ! } ! //get brightness ! if (!relBrightnessInValue->isNil()) ! { ! RCPtr<Int> relBrightnessPtr = relBrightnessInValue; ! relBrightness = *relBrightnessPtr; ! command->setRelativeBrightness(relBrightness); ! } ! ! //get pan ! if (!absPanInValue->isNil()) ! { ! RCPtr<Int> absPanPtr = absPanInValue; ! absPan = *absPanPtr; ! command->setAbsolutePan(absPan); ! } ! //get tilt ! if (!absTiltInValue->isNil()) ! { ! RCPtr<Int> absTiltPtr = absTiltInValue; ! absTilt = *absTiltPtr; ! command->setAbsoluteTilt(absTilt); ! } ! //get zoom ! if (!absZoomInValue->isNil()) ! { ! RCPtr<Int> absZoomPtr = absZoomInValue; ! absZoom = *absZoomPtr; ! command->setAbsoluteZoom(absZoom); ! } ! //get contrast ! if (!absContrastInValue->isNil()) ! { ! RCPtr<Int> absContrastPtr = absContrastInValue; ! absContrast = *absContrastPtr; ! command->setAbsoluteContrast(absContrast); ! } ! //get brightness ! if (!absBrightnessInValue->isNil()) ! { ! RCPtr<Int> absBrightnessPtr = absBrightnessInValue; ! absBrightness = *absBrightnessPtr; ! command->setAbsoluteBrightness(absBrightness); ! } ! } } - - - - //set PTZ - if (command) - { - state = command->getState(); - //output values - (*outputs[m_commandOutID].buffer)[count] = ObjectRef(command); - - - if(state[CommandCamera::REL_PAN] == 1) - { - (*outputs[m_relPanOutID].buffer)[count] = ObjectRef(Int::alloc(relPan)); - } - else if(state[CommandCamera::REL_PAN] == 0) - { - (*outputs[m_relPanOutID].buffer)[count] = nilObject; - } - - if(state[CommandCamera::REL_TILT] == 1) - (*outputs[m_relTiltOutID].buffer)[count] = ObjectRef(Int::alloc(relTilt)); - else - (*outputs[m_relTiltOutID].buffer)[count] = nilObject; - - if(state[CommandCamera::REL_ZOOM] == 1) - (*outputs[m_relZoomOutID].buffer)[count] = ObjectRef(Int::alloc(relZoom)); - else - (*outputs[m_relZoomOutID].buffer)[count] = nilObject; - - if(state[CommandCamera::REL_BRIGHTNESS] == 1) - (*outputs[m_relBrightnessOutID].buffer)[count] = ObjectRef(Int::alloc(relBrightness)); - else - (*outputs[m_relBrightnessOutID].buffer)[count] = nilObject; - - if(state[CommandCamera::REL_CONTRAST] == 1) - (*outputs[m_relContrastOutID].buffer)[count] = ObjectRef(Int::alloc(relContrast)); - else - (*outputs[m_relContrastOutID].buffer)[count] = nilObject; - - if(state[CommandCamera::ABS_PAN] == 1) - (*outputs[m_absPanOutID].buffer)[count] = ObjectRef(Int::alloc(absPan)); - else - (*outputs[m_absPanOutID].buffer)[count] = nilObject; - - if(state[CommandCamera::ABS_TILT] == 1) - (*outputs[m_absTiltOutID].buffer)[count] = ObjectRef(Int::alloc(absTilt)); - else - (*outputs[m_absTiltOutID].buffer)[count] = nilObject; - - if(state[CommandCamera::ABS_ZOOM] == 1) - (*outputs[m_absZoomOutID].buffer)[count] = ObjectRef(Int::alloc(absZoom)); - else - (*outputs[m_absZoomOutID].buffer)[count] = nilObject; - - if(state[CommandCamera::ABS_BRIGHTNESS] == 1) - (*outputs[m_absBrightnessOutID].buffer)[count] = ObjectRef(Int::alloc(absBrightness)); - else - (*outputs[m_absBrightnessOutID].buffer)[count] = nilObject; - - if(state[CommandCamera::ABS_CONTRAST] == 1) - (*outputs[m_absContrastOutID].buffer)[count] = ObjectRef(Int::alloc(absContrast)); - else - (*outputs[m_absContrastOutID].buffer)[count] = nilObject; - } - else - { - //output values - (*outputs[m_relBrightnessOutID].buffer)[count] = nilObject; - (*outputs[m_commandOutID].buffer)[count] = nilObject; - (*outputs[m_relContrastOutID].buffer)[count] = nilObject; - (*outputs[m_relPanOutID].buffer)[count] = nilObject; - (*outputs[m_relTiltOutID].buffer)[count] = nilObject; - (*outputs[m_relZoomOutID].buffer)[count] = nilObject; - (*outputs[m_absBrightnessOutID].buffer)[count] = nilObject; - (*outputs[m_absContrastOutID].buffer)[count] = nilObject; - (*outputs[m_absPanOutID].buffer)[count] = nilObject; - (*outputs[m_absTiltOutID].buffer)[count] = nilObject; - (*outputs[m_absZoomOutID].buffer)[count] = nilObject; - } } ! else ! { ! out[count] = nilObject; ! } ! } ! ! void MarieCommandCamera::printOn(ostream &out) const ! { ! MarieXMLDataFactory factory; ! ! //writing XML data ! string value = factory.toString((CommandCamera) (*this)); ! ! out.write(value.c_str(), value.size()); ! ! } ! ! ! void MarieCommandCamera::readFrom(istream &in) ! { ! throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! } ! ! void MarieCommandCamera::copyDataAbstract(DataAbstract *data) ! { ! ! if (data) ! { ! CommandCamera *command = dynamic_cast<CommandCamera*>(data); ! if (command) ! { ! //((CommandCamera*)this)->operator=(*command); ! this->CommandCamera::operator=(*command); ! } ! else ! { ! throw new GeneralException(string("Unable to cast into CommandCamera Abstract : ") + data->getID(),__FILE__,__LINE__); ! } ! } ! ! } } --- 31,79 ---- namespace marie { ! using namespace std; ! ! DECLARE_TYPE2(CommandCamera::ID,MarieCommandCamera) ! ! MarieCommandCamera::MarieCommandCamera() ! { ! } ! ! MarieCommandCamera::MarieCommandCamera (const CommandCamera &command) ! :CommandCamera(command) ! { ! ! } ! ! void MarieCommandCamera::printOn(ostream &out) const ! { ! MarieXMLDataFactory factory; ! ! //writing XML data ! string value = factory.toString((CommandCamera) (*this)); ! ! out.write(value.c_str(), value.size()); ! } ! ! void MarieCommandCamera::readFrom(istream &in) ! { ! throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! } ! ! void MarieCommandCamera::copyDataAbstract(DataAbstract *data) ! { ! if (data) ! { ! CommandCamera *command = dynamic_cast<CommandCamera*>(data); ! if (command) { ! //((CommandCamera*)this)->operator=(*command); ! this->CommandCamera::operator=(*command); } else { ! throw new GeneralException(string("Unable to cast into CommandCamera Abstract : ") + data->getID(),__FILE__,__LINE__); } } ! } } Index: MarieCommandMotor.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/MarieCommandMotor.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** MarieCommandMotor.cpp 22 Aug 2005 21:35:01 -0000 1.9 --- MarieCommandMotor.cpp 7 Sep 2005 21:12:48 -0000 1.10 *************** *** 30,198 **** namespace marie { ! DECLARE_NODE(MarieCommandMotor) ! /*Node ! * ! * @name MarieCommandMotor ! * @category RobotFlow:MARIE:zdeprecated ! * @description Save an object ! * ! * @input_name COMMAND_MOTOR ! * @input_type MarieCommandMotor ! * @input_description CommandMotor data structure input ! * ! * @input_name VELOCITY ! * @input_type int ! * @input_description input velocity ! * ! * @input_name ROTATION ! * @input_type int ! * @input_description input rotation ! * ! * @output_name COMMAND_MOTOR ! * @output_type MarieCommandMotor ! * @output_description CommandMotor data structure output ! * ! * @output_name VELOCITY ! * @output_type int ! * @output_description output velocity ! * ! * @output_name ROTATION ! * @output_type int ! * @output_description output rotation ! * ! END*/ ! ! ! using namespace std; ! ! DECLARE_TYPE2(CommandMotor::ID,MarieCommandMotor) ! ! ! MarieCommandMotor::MarieCommandMotor() ! : MarieObject("MarieCommandMotor",ParameterSet()), m_isNode(false) ! { ! ! } ! ! MarieCommandMotor::MarieCommandMotor (const CommandMotor &command) ! : MarieObject("MarieCommandMotor",ParameterSet()), CommandMotor(command), m_isNode(false) ! { ! ! } ! ! MarieCommandMotor::MarieCommandMotor(string nodeName, ParameterSet params) ! : MarieObject(nodeName,params), m_isNode(true) ! { ! //used as a BufferedNode, create inputs & outputs ! ! //inputs ! m_commandInID = addInput("COMMAND_MOTOR"); ! m_velocityInID = addInput("VELOCITY"); ! m_rotationInID = addInput("ROTATION"); ! ! //outputs ! m_commandOutID = addOutput("COMMAND_MOTOR"); ! m_velocityOutID = addOutput("VELOCITY"); ! m_rotationOutID = addOutput("ROTATION"); ! } ! ! void MarieCommandMotor::calculate(int output_id, int count, Buffer &out) ! { ! if (m_isNode) ! { ! MarieCommandMotor *command = NULL; ! int velocity = 0; ! int rotation = 0; ! ! //get all inputs ! ObjectRef commandInValue = getInput(m_commandInID,count); ! ObjectRef velocityInValue = getInput(m_velocityInID,count); ! ObjectRef rotationInValue = getInput(m_rotationInID,count); ! ! //initialize new CommandMotor ! if(!commandInValue->isNil()) ! { ! RCPtr<MarieCommandMotor> commandPtr = commandInValue; ! command = new MarieCommandMotor(*commandPtr); ! velocity = command->getVelocity(); ! rotation = command->getRotation(); ! } ! else ! { ! if (!velocityInValue->isNil() && !rotationInValue->isNil()) ! { ! command = new MarieCommandMotor(); ! } ! } ! ! //get velocity ! if (!velocityInValue->isNil()) ! { ! RCPtr<Int> velocityPtr = velocityInValue; ! velocity = *velocityPtr; ! } ! ! //get rotation ! if (!rotationInValue->isNil()) ! { ! RCPtr<Int> rotationPtr = rotationInValue; ! rotation = *rotationPtr; ! } ! ! ! //set new rotation & velocity ! if (command) ! { ! command->setVelocity(velocity); ! command->setRotation(rotation); ! (*outputs[m_commandOutID].buffer)[count] = ObjectRef(command); ! (*outputs[m_velocityOutID].buffer)[count] = ObjectRef(Int::alloc(velocity)); ! (*outputs[m_rotationOutID].buffer)[count] = ObjectRef(Int::alloc(rotation)); ! } ! else ! { ! (*outputs[m_commandOutID].buffer)[count] = nilObject; ! (*outputs[m_velocityOutID].buffer)[count] = nilObject; ! (*outputs[m_rotationOutID].buffer)[count] = nilObject; ! } ! } ! else //not a node... ! { ! out[count] = nilObject; ! } ! } ! ! void MarieCommandMotor::printOn(ostream &out) const ! { ! MarieXMLDataFactory factory; ! ! //writing XML data ! string value = factory.toString((CommandMotor) (*this)); ! ! out.write(value.c_str(), value.size()); ! } ! ! ! void MarieCommandMotor::readFrom(istream &in) ! { ! throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! } ! ! void MarieCommandMotor::copyDataAbstract(DataAbstract *data) ! { ! if (data) ! { ! CommandMotor *command = dynamic_cast<CommandMotor*>(data); ! if (command) ! { ! //((CommandMotor*)this)->operator=(*command); ! this->CommandMotor::operator=(*command); ! } ! else ! { ! throw new GeneralException(string("Unable to cast into CommanMotor Abstract : ") + data->getID(),__FILE__,__LINE__); ! } ! } ! } } --- 30,79 ---- namespace marie { ! using namespace std; ! ! DECLARE_TYPE2(CommandMotor::ID,MarieCommandMotor) ! ! ! MarieCommandMotor::MarieCommandMotor() ! { ! } ! ! MarieCommandMotor::MarieCommandMotor (const CommandMotor &command) ! :CommandMotor(command) ! { ! ! } ! ! void MarieCommandMotor::printOn(ostream &out) const ! { ! MarieXMLDataFactory factory; ! ! //writing XML data ! string value = factory.toString((CommandMotor) (*this)); ! ! out.write(value.c_str(), value.size()); ! } ! ! void MarieCommandMotor::readFrom(istream &in) ! { ! throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! } ! ! void MarieCommandMotor::copyDataAbstract(DataAbstract *data) ! { ! if (data) ! { ! CommandMotor *command = dynamic_cast<CommandMotor*>(data); ! if (command) ! { ! //((CommandMotor*)this)->operator=(*command); ! this->CommandMotor::operator=(*command); ! } ! else ! { ! throw new GeneralException(string("Unable to cast into CommanMotor Abstract : ") + data->getID(),__FILE__,__LINE__); ! } ! } ! } } Index: MarieDataSonar.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/MarieDataSonar.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MarieDataSonar.cpp 22 Aug 2005 21:21:07 -0000 1.7 --- MarieDataSonar.cpp 7 Sep 2005 21:12:48 -0000 1.8 *************** *** 31,137 **** namespace marie { ! DECLARE_NODE(MarieDataSonar) ! /*Node ! * ! * @name MarieDataSonar ! * @category RobotFlow:MARIE:zdeprecated ! * @description Save an object ! * ! * @input_name DATA_SONAR ! * @input_type MarieDataLaser ! * @input_description MarieDataLaser object ! * ! * @output_name RANGES ! * @output_description Range contained in the MarieDataSonar object ! * @output_type Vector<int> ! * ! END*/ ! ! DECLARE_TYPE2(DataSonar::ID,MarieDataSonar) ! ! using namespace std; ! ! MarieDataSonar::MarieDataSonar() ! : MarieObject("MarieDataSonar",ParameterSet()), m_isNode(false) ! { ! ! } ! ! MarieDataSonar::MarieDataSonar (const DataSonar &data) ! : MarieObject("MarieDataSonar",ParameterSet()), DataSonar(data), ! m_isNode(false) ! { ! ! } ! ! MarieDataSonar::MarieDataSonar(string nodeName, ParameterSet params) ! : MarieObject(nodeName,params), m_isNode(true) ! { ! //used as a BufferedNode, create inputs & outputs ! m_inputID = addInput("DATA_SONAR"); ! m_rangeID = addOutput("RANGES"); ! } ! ! void MarieDataSonar::calculate(int output_id, int count, Buffer &out) ! { ! ObjectRef InputValue = getInput(m_inputID,count); ! ! if (m_isNode && !InputValue->isNil()) ! { ! RCPtr<MarieDataSonar> sonarObject = InputValue; ! ! unsigned int size = sonarObject->getNbSonar(); ! const unsigned int *ranges = sonarObject->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 ! { ! out[count] = nilObject; ! } ! } ! ! 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__); ! } ! } ! ! } } --- 31,79 ---- 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: newMarieDataMap.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/newMarieDataMap.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** newMarieDataMap.cpp 29 Mar 2005 15:20:43 -0000 1.4 --- newMarieDataMap.cpp 7 Sep 2005 21:12:48 -0000 1.5 *************** *** 20,23 **** --- 20,24 ---- */ #include "MarieDataMap.h" + #include "BufferedNode.h" #include <sstream> #include <string> Index: MarieCommandBehavior.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/MarieCommandBehavior.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** MarieCommandBehavior.cpp 22 Aug 2005 21:35:01 -0000 1.9 --- MarieCommandBehavior.cpp 7 Sep 2005 21:12:48 -0000 1.10 *************** *** 33,208 **** namespace marie { ! DECLARE_NODE(MarieCommandBehavior) ! /*Node ! * ! * @name MarieCommandBehavior ! * @category RobotFlow:MARIE:zdeprecated ! * @description Save an object ! * ! * @input_name BEHAVIOR_COMMAND ! * @input_type MarieCommandBehavior ! * @input_description Input BehaviorCommand data object ! * ! * @input_name BEHAVIOR_NAME ! * @input_type String ! * @input_description The behavior name that will be activated/deactivated ! * ! * @input_name BEHAVIOR_ACTIVATION ! * @input_type Bool ! * @input_description true if the specified behavior is activated ! * ! * @input_name BEHAVIOR_RESULTS ! * @input_type String ! * @input_description Results in string format separated by space ! * ! * @output_name BEHAVIOR_COMMAND ! * @output_description Output BehaviorCommand data object ! * @output_type MarieCommandBahavior ! * ! * @output_name ROBOTFLOW_ACTIVATION ! * @output_description RobotFlow activation vector ! * @output_type Vector<int> ! * ! * @output_name ROBOTFLOW_EXPLOITATION ! * @output_description RobotFlow exploitation vector ! * @output_type Vector<int> ! * ! END*/ ! ! ! using namespace std; ! ! DECLARE_TYPE2(CommandBehavior::ID,MarieCommandBehavior) ! ! MarieCommandBehavior::MarieCommandBehavior() ! : MarieObject("MarieCommandBehavior",ParameterSet()), m_isNode(false) ! { ! ! } ! ! MarieCommandBehavior::MarieCommandBehavior (const CommandBehavior &command) ! : MarieObject("MarieCommandBehavior",ParameterSet()), CommandBehavior(command), ! m_isNode(false) ! { ! ! } ! ! MarieCommandBehavior::MarieCommandBehavior(string nodeName, ParameterSet params) ! : MarieObject(nodeName,params), m_isNode(true) ! { ! //used as a BufferedNode, create inputs & outputs ! ! //inputs ! m_commandInID = addInput("BEHAVIOR_COMMAND"); ! m_behaviorNameInID = addInput("BEHAVIOR_NAME"); ! m_behaviorActivationInID = addInput("BEHAVIOR_ACTIVATION"); ! m_behaviorExploitationInID = addInput("BEHAVIOR_EXPLOITATION"); ! m_behaviorResultsInID = addInput("BEHAVIOR_RESULTS"); ! ! //outputs ! m_commandOutID = addOutput("BEHAVIOR_COMMAND"); ! m_RobotFlowActivationOutID = addOutput("ROBOTFLOW_ACTIVATION"); ! } ! ! void MarieCommandBehavior::calculate(int output_id, int count, Buffer &out) ! { ! if (m_isNode) ! { ! MarieCommandBehavior *command = NULL; ! ! ObjectRef commandInValue = getInput(m_commandInID,count); ! ObjectRef behaviorNameValue = getInput(m_behaviorNameInID,count); ! ObjectRef behaviorActivationValue = getInput(m_behaviorActivationInID,count); ! ObjectRef behaviorExploitationValue = getInput(m_behaviorExploitationInID,count); ! ObjectRef behaviorResultsValue = getInput(m_behaviorResultsInID,count); ! ! //create command object ! if (!commandInValue->isNil()) { ! RCPtr<MarieCommandBehavior> behaviorPtr = getInput(m_commandInID,count); ! command = new MarieCommandBehavior(*behaviorPtr); } else { ! command = new MarieCommandBehavior(); ! } ! ! //look for activation for the desired behavior ! if (!behaviorNameValue->isNil() && !behaviorActivationValue->isNil()) ! { ! RCPtr<String> behaviorNamePtr = behaviorNameValue; ! RCPtr<Bool> behaviorActivationPtr = behaviorActivationValue; ! command->setActivation(*behaviorNamePtr,*behaviorActivationPtr); ! } ! ! //look for activation for the desired behavior ! if (!behaviorNameValue->isNil() && !behaviorExploitationValue->isNil()) ! { ! RCPtr<String> behaviorNamePtr = behaviorNameValue; ! RCPtr<Bool> behaviorExploitationPtr = behaviorExploitationValue; ! command->setActivation(*behaviorNamePtr,*behaviorExploitationPtr); ! } ! ! //look for activation for the desired behavior ! if (!behaviorNameValue->isNil() && !behaviorResultsValue->isNil()) ! { ! RCPtr<String> behaviorNamePtr = behaviorNameValue; ! RCPtr<String> behaviorResultsPtr = behaviorResultsValue; ! command->setResults(*behaviorNamePtr,*behaviorResultsPtr); ! } ! ! //create behavior activation vector (RobotFlow) ! Vector<int> *vect = Vector<int>::alloc(Behavior::get_behavior_size()); ! ! //get known behavior names ! vector<string>& behaviorNames = Behavior::get_behaviors(); ! ! //initialize to false (not activated) ! for (unsigned int i = 0; i < vect->size(); i++) ! { ! //TODO check if behavior exists ! (*vect)[i] = (int) command->getActivation(behaviorNames[i]); ! } ! ! (*outputs[m_commandOutID].buffer)[count] = ObjectRef(command); ! (*outputs[m_RobotFlowActivationOutID].buffer)[count] = ObjectRef(vect); ! } ! } ! ! void MarieCommandBehavior::printOn(ostream &out) const ! { ! ! MarieXMLDataFactory factory; ! ! //writing XML data ! string value = factory.toString((CommandBehavior) (*this)); ! ! out.write(value.c_str(), value.size()); ! } ! ! ! void MarieCommandBehavior::readFrom(istream &in) ! { ! throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! } ! ! void MarieCommandBehavior::copyDataAbstract(DataAbstract *data) ! { ! ! if (data) ! { ! CommandBehavior *command = dynamic_cast<CommandBehavior*>(data); ! if (command) ! { ! //((CommandBehavior*)this)->operator=(*command); ! this->CommandBehavior::operator=(*command); ! } ! else ! { ! throw new GeneralException(string("Unable to cast into CommandBehavior Abstract : ") + data->getID(),__FILE__,__LINE__); ! } ! } ! ! } } --- 33,82 ---- namespace marie { ! using namespace std; ! ! DECLARE_TYPE2(CommandBehavior::ID,MarieCommandBehavior) ! ! MarieCommandBehavior::MarieCommandBehavior() ! { ! ! } ! ! MarieCommandBehavior::MarieCommandBehavior (const CommandBehavior &command) ! :CommandBehavior(command) ! { ! ! } ! ! void MarieCommandBehavior::printOn(ostream &out) const ! { ! MarieXMLDataFactory factory; ! ! //writing XML data ! string value = factory.toString((CommandBehavior) (*this)); ! ! out.write(value.c_str(), value.size()); ! } ! ! void MarieCommandBehavior::readFrom(istream &in) ! { ! throw new GeneralException("readFrom not supported. Use the MarieLoad Node to read data from the stream.",__FILE__,__LINE__); ! } ! ! void MarieCommandBehavior::copyDataAbstract(DataAbstract *data) ! { ! if (data) ! { ! CommandBehavior *command = dynamic_cast<CommandBehavior*>(data); ! if (command) { ! //((CommandBehavior*)this)->operator=(*command); ! this->CommandBehavior::operator=(*command); } else { ! throw new GeneralException(string("Unable to cast into CommandBehavior Abstract : ") + data->getID(),__FILE__,__LINE__); ! } ! } ! } } Index: MarieDataOdometry.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/MarieDataOdometry.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MarieDataOdometry.cpp 22 Aug 2005 21:21:07 -0000 1.7 --- MarieDataOdometry.cpp 7 Sep 2005 21:12:48 -0000 1.8 *************** *** 30,187 **** namespace marie { ! DECLARE_NODE(MarieDataOdometry) ! /*Node ! * ! * @name MarieDataOdometry ! * @category RobotFlow:MARIE:zdeprecated ! * @description Read content of MarieDataOdometry ! * ! * @input_name ODOMETRY_DATA ! * @input_type MarieDataOdometry ! * @input_description The Odometry object ! * ! * @output_name XPOS ! * @output_description X axis position ! * @output_type int ! * ! * @output_name YPOS ! * @output_description Y axis position ! * @output_type int ! * ! * @output_name ZPOS ! * @output_description Z axis position ! * @output_type int ! * ! * @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 ! * @output_type int ! * ! * @output_name LINEAR_SPEED ! * @output_description linear speed (X-Y) ! * @output_type int ! * ! * @output_name SIDE_SPEED ! * @output_description translational speed (X-Y) ! * @output_type int ! * ! * @output_name ROTATION_SPEED ! * @output_description rotation speed (X-Y) ! * @output_type int ! * ! END*/ ! ! ! using namespace std; ! ! DECLARE_TYPE2(DataOdometry::ID,MarieDataOdometry) ! ! MarieDataOdometry::MarieDataOdometry() ! : MarieObject("MarieDataOdometry",ParameterSet()), m_isNode(false) ! { ! ! } ! ! MarieDataOdometry::MarieDataOdometry (const DataOdometry &data) ! : MarieObject("MarieDataOdometry",ParameterSet()), DataOdometry(data), ! m_isNode(false) ! { ! ! } ! ! MarieDataOdometry::MarieDataOdometry(string nodeName, ParameterSet params) ! : MarieObject(nodeName,params), m_isNode(true) ! { ! //used as a BufferedNode, create inputs & outputs ! ! //input ! m_inputID = addInput("ODOMETRY_DATA"); ! ! //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 MarieDataOdometry::calculate(int output_id, int count, Buffer &out) ! { ! ! ObjectRef InputValue = getInput(m_inputID,count); ! ! ! if (m_isNode && !InputValue->isNil()) ! { ! RCPtr<MarieDataOdometry> odometryObject = InputValue; ! ! int x,y,z,yaw,pitch,roll, linspeed, sidespeed,rotspeed; ! odometryObject->getPosition(x,y,z); ! odometryObject->getOrientation(yaw,pitch,roll); ! odometryObject->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 ! { ! out[count] = nilObject; ! } ! } ! ! 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__); ! } ! } ! ! } } --- 30,78 ---- 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: MarieDataLaser.cpp =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/MARIE/src/MarieDataLaser.cpp,v retrieving revision 1.8 retrieving revision 1.... [truncated message content] |