Skip to content
This repository has been archived by the owner on Feb 21, 2021. It is now read-only.

added drone interfaces to comm #937

Merged
merged 3 commits into from
Oct 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/libs/comm_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ set(HEADERS
include/jderobot/comm/rgbdClient.hpp
include/jderobot/comm/interfaces/rgbdClient.hpp
include/jderobot/comm/ice/rgbdIceClient.hpp
include/jderobot/comm/cmdvelClient.hpp
include/jderobot/comm/interfaces/cmdvelClient.hpp
include/jderobot/comm/ice/cmdvelIceClient.hpp
include/jderobot/comm/navdataClient.hpp
include/jderobot/comm/interfaces/navdataClient.hpp
include/jderobot/comm/ice/navdataIceClient.hpp
include/jderobot/comm/ardroneextraClient.hpp
include/jderobot/comm/interfaces/ardroneextraClient.hpp
include/jderobot/comm/ice/ardroneextraIceClient.hpp
)

set(SOURCES
Expand All @@ -63,6 +72,12 @@ set(SOURCES
src/ice/motorsIceClient.cpp
src/rgbdClient.cpp
src/ice/rgbdIceClient.cpp
src/cmdvelClient.cpp
src/ice/cmdvelIceClient.cpp
src/ardroneextraClient.cpp
src/ice/ardroneextraIceClient.cpp
src/navdataClient.cpp
src/ice/navdataIceClient.cpp
)


Expand Down
49 changes: 49 additions & 0 deletions src/libs/comm_cpp/include/jderobot/comm/ardroneextraClient.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright (C) 1997-2016 JDE Developers Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
* Authors :
* Aitor Martinez Fernandez <aitor.martinez.fernandez@gmail.com>
*/

#ifndef JDEROBOTCOMM_ARDRONEEXTRACLIENT_H
#define JDEROBOTCOMM_ARDRONEEXTRACLIENT_H


#include <Ice/Communicator.h>
#include <jderobot/comm/communicator.hpp>
#include <jderobot/comm/interfaces/ardroneextraClient.hpp>





namespace Comm {

/**
* @brief make a ArDroneExtraClient using propierties
*
*
* @param communicator that contains properties
* @param prefix of client Propierties (example: "Uav_viewer.ArDroneExtra")
*
*
* @return null if propierties are wrong
*/
ArDroneExtraClient* getArDroneExtraClient(Comm::Communicator* jdrc, std::string prefix);


} //NS

#endif // JDEROBOTCOMM_ARDRONEEXTRACLIENT_H
49 changes: 49 additions & 0 deletions src/libs/comm_cpp/include/jderobot/comm/cmdvelClient.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright (C) 1997-2016 JDE Developers Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
* Authors :
* Aitor Martinez Fernandez <aitor.martinez.fernandez@gmail.com>
*/

#ifndef JDEROBOTCOMM_CMDVELCLIENT_H
#define JDEROBOTCOMM_CMDVELCLIENT_H

#include <jderobot/types/cmdvel.h>
#include <Ice/Communicator.h>
#include <jderobot/comm/communicator.hpp>
#include <jderobot/comm/interfaces/cmdvelClient.hpp>





namespace Comm {

/**
* @brief make a CMDVelClient using propierties
*
*
* @param communicator that contains properties
* @param prefix of client Propierties (example: "Uav_viewer.CMDVel")
*
*
* @return null if propierties are wrong
*/
CMDVelClient* getCMDVelClient(Comm::Communicator* jdrc, std::string prefix);


} //NS

#endif // JDEROBOTCOMM_CMDVELCLIENT_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright (C) 1997-2017 JDE Developers
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
* Author : Aitor Martinez Fernandez <aitor.martinez.fernandez@gmail.com>
*/

#ifndef JDEROBOTCOMM_ARDRONEEXTRAICECLIENT_H_
#define JDEROBOTCOMM_ARDRONEEXTRAICECLIENT_H_

#include <IceUtil/IceUtil.h>
#include <iostream>
#include <Ice/Ice.h>
#include <jderobot/ardroneextra.h>
#include <jderobot/comm/communicator.hpp>
#include <jderobot/comm/interfaces/ardroneextraClient.hpp>

namespace Comm {


class ArDroneExtraIceClient: public Comm::ArDroneExtraClient {
public:
ArDroneExtraIceClient(Comm::Communicator* jdrc, std::string prefix);
virtual ~ArDroneExtraIceClient();

virtual void toggleCam();
virtual void land();
virtual void takeoff();
virtual void reset();
virtual void recordOnUsb(bool record);
virtual void ledAnimation(int type,float duration, float req);
virtual void flightAnimation(int type, float duration);
virtual void flatTrim();



private:
std::string prefix;
jderobot::ArDroneExtraPrx prx;
IceUtil::Mutex controlMutex;


};


} /* namespace jderobotcomm */
#endif /* JDEROBOTCOMM_ARDRONEEXTRAICECLIENT_H_ */
53 changes: 53 additions & 0 deletions src/libs/comm_cpp/include/jderobot/comm/ice/cmdvelIceClient.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright (C) 1997-2017 JDE Developers
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
* Author : Aitor Martinez Fernandez <aitor.martinez.fernandez@gmail.com>
*/

#ifndef JDEROBOTCOMM_CMDVELSICECLIENT_H_
#define JDEROBOTCOMM_CMDVELSICECLIENT_H_

#include <IceUtil/IceUtil.h>
#include <iostream>
#include <Ice/Ice.h>
#include <jderobot/cmdvel.h>
#include <jderobot/types/cmdvel.h>
#include <jderobot/comm/communicator.hpp>
#include <jderobot/comm/interfaces/cmdvelClient.hpp>

namespace Comm {


class CMDVelIceClient: public Comm::CMDVelClient {
public:
CMDVelIceClient(Comm::Communicator* jdrc, std::string prefix);
virtual ~CMDVelIceClient();

virtual void sendVelocities(JdeRobotTypes::CMDVel vel);



private:
std::string prefix;
jderobot::CMDVelPrx prx;
IceUtil::Mutex controlMutex;


};


} /* namespace jderobotcomm */
#endif /* JDEROBOTCOMM_CMDVELSICECLIENT_H_ */
70 changes: 70 additions & 0 deletions src/libs/comm_cpp/include/jderobot/comm/ice/navdataIceClient.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright (C) 1997-2013 JDE Developers TeamkinectViewer.camRGB
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
* Author : Jose María Cañas <jmplaza@gsyc.es>
Francisco Miguel Rivas Montero <franciscomiguel.rivas@urjc.es>

*/

#ifndef JDEROBOTCOMM_NAVDATAICECLIENT_H_
#define JDEROBOTCOMM_NAVDATAICECLIENT_H_

#include <IceUtil/IceUtil.h>
#include <iostream>
#include <Ice/Ice.h>
#include <jderobot/navdata.h>
#include <cv.h>
#include <sstream>
#include <fstream>
#include <logger/Logger.h>
#include <jderobot/types/navdataData.h>
#include <jderobot/comm/communicator.hpp>
#include <jderobot/comm/interfaces/navdataClient.hpp>

namespace Comm {


class NavdataIceClient: public IceUtil::Thread, public Comm::NavdataClient {
public:
NavdataIceClient(Comm::Communicator* jdrc, std::string prefix);
virtual ~NavdataIceClient();
virtual void run();

virtual JdeRobotTypes::NavdataData getNavdataData();
int getRefreshRate(){return refreshRate;};
void pause();
void resume();
bool getPause(){return pauseStatus;};



private:
std::string prefix;
jderobot::NavdataPrx prx;
long long int cycle;
IceUtil::Mutex controlMutex;
bool debug;
bool _done;
int refreshRate;
bool pauseStatus;

IceUtil::Cond sem;

};


} /* namespace jderobot */
#endif /* JDEROBOTCOMM_NAVDATAICECLIENT_H_ */
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright (C) 1997-2017 JDE Developers Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
* Authors :
* Aitor Martinez Fernandez <aitor.martinez.fernandez@gmail.com>
*/

#ifndef JDEROBOTCOMM_CMDVELCLIENT_INTERFACE_H
#define JDEROBOTCOMM_CMDVELCLIENT_INTERFACE_H


namespace Comm {

/**
* @brief MotorsClient class.
* This class is a Interface to seprate communications from tools.
* With this, the tools don't need know which communicator (ROS or ICE) are using because both use the same interface.
*
*/
class ArDroneExtraClient {
public:
bool on = false;

virtual void toggleCam()=0;
virtual void land()=0;
virtual void takeoff()=0;
virtual void reset()=0;
virtual void recordOnUsb(bool record)=0;
virtual void ledAnimation(int type,float duration, float req)=0;
virtual void flightAnimation(int type, float duration)=0;
virtual void flatTrim()=0;

};

} //NS

#endif // JDEROBOTCOMM_CMDVELCLIENT_INTERFACE_H
Loading