ROSjloComm.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2009 by Ulrich Friedrich Klank <klank@in.tum.de>
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 3 of the License, or
00007  * (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 
00019 #ifndef ROSJLOCOMM_H_INCLUDED
00020 #define ROSJLOCOMM_H_INCLUDED
00021 
00022 #ifndef USE_YARP_COMM
00023 
00024 #include "RelPose.h"
00025 #include "Comm.h"
00026 
00027 #include <ros/ros.h>
00028 #include <vision_srvs/srvjlo.h>
00029 
00030 namespace cop
00031 {
00032   /*****************************************************************************************
00033   *  class ROSjloComm                                                                      */
00034   /*****************************************************************************************
00035   *  Class organizing the communication to a the jlo ROS service
00036   ******************************************************************************************/
00037   class ROSjloComm : public Comm, public jlo::LazyLocatedObjectLoader
00038   {
00039   public:
00040     /*****************************************************************************************
00041     *  Constructor
00042     * @param nodeName
00043     ******************************************************************************************/
00044      ROSjloComm(std::string nodeName);
00045      /*****************************************************************************************
00046     *  Destructor
00047     ******************************************************************************************/
00048      ~ROSjloComm();
00049 
00050     /*****************************************************************************************
00051     *  NotifyPoseUpdate                                                                        */
00052     /*****************************************************************************************
00053     *  Call back that is called whenever a new pose is set for a certain model
00054     *  This callback must be told the signature that is tracked
00055     ******************************************************************************************/
00056     virtual void NotifyPoseUpdate(RelPose* pose, bool sendObjectRelation = true);
00057 
00058     /*****************************************************************************************
00059     *  CreateNewPose                                                                          */
00060     /*****************************************************************************************
00061     ******************************************************************************************/
00062     virtual RelPose* CreateNewPose(RelPose* pose, Matrix* mat, Matrix* cov);
00063     virtual RelPose* CreateNewPose(LocatedObjectID_t parent, Matrix* mat, Matrix* cov);
00064     /*****************************************************************************************
00065     *  UpdatePose                                                                           */
00066     /*****************************************************************************************
00067     *  @brief updates a relpose (sending new information to jlo) including a new parent
00068     *  @param pose    the old pose, that should be replaced
00069     *  @param parent  the new parent
00070     *  @param mat     the new matrix containing the transformation from the parent
00071     *  @param cov     the new matrix containing the covariance relative to mat
00072     *
00073     ******************************************************************************************/
00074     virtual RelPose* UpdatePose(RelPose* pose, LocatedObjectID_t parent, Matrix* mat, Matrix* cov);
00075 
00076     /*****************************************************************************************
00077     *  GetPose                                                                              */
00078     /*****************************************************************************************
00079     *  @param   poseId The lo-id of the position to get
00080     *  @remarks return NULL if the id does not exist
00081     ******************************************************************************************/
00082     virtual RelPose* GetPose(LocatedObjectID_t poseId);
00083     /*****************************************************************************************
00084     *  GetPose                                                                              */
00085     /*****************************************************************************************
00086     *  @param   poseId The name of a lo of the position to get
00087     *  @param   wait   specifies wether this function should block if the name does no exist.
00088     *
00089     *  Getting names from jlo could depend on other system to come up,
00090     *  so waiting might be a good idea in some situations.
00091     *
00092     *  @remarks if wait = false the function returns NULL if the name does does not exist
00093     ******************************************************************************************/
00094     virtual RelPose* GetPose(const std::string poseId, bool wait = true);
00095 
00096     virtual jlo::LocatedObject* GetParent(const jlo::LocatedObject& child);
00097 
00098     virtual RelPose* GetPoseRelative(LocatedObjectID_t poseId, LocatedObjectID_t parentPoseId);
00099 
00100     virtual bool FreePose(LocatedObjectID_t poseId);
00101 
00102   private:
00103     ROSjloComm& operator=(ROSjloComm&){throw "Error";}
00104     bool GetJloServiceClient(vision_srvs::srvjlo &msg);
00105 
00106 
00110     std::string m_service;
00111     ros::ServiceClient m_client;
00112   };
00113 }
00114 #endif /* USE_YARP_COMM */
00115 #endif /* ROSJLOCOMM_H_INCLUDED */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


cognitive_perception
Author(s): Ulrich F Klank
autogenerated on Thu May 23 2013 07:38:35