Blink1.h
Go to the documentation of this file.
00001 /*
00002 * Copyright (c) 2016 Carnegie Mellon University, Guilherme Pereira <gpereira@cmu.edu>
00003 *
00004 * For License information please see the LICENSE file in the root directory.
00005 *
00006 */
00007 
00008 #include "ros/ros.h"
00009 #include "blink1/Blink.h"
00010 #include "blink1/blinkfn.h"
00011 
00012 #ifndef _BLINK1_CLASS
00013 
00014 #define _BLINK1_CLASS
00015 
00016 class Blink1
00017 {
00018 private:
00019   ros::ServiceClient client_;
00020   blink1::Blink srv_;
00021 public:
00022   Blink1(ros::NodeHandle& n){
00023        client_ = n.serviceClient<blink1::Blink>("blink1/blink");    
00024   }
00025   
00026   bool fade(uint8_t r, uint8_t g, uint8_t b, int t){
00027     srv_.request.function = BL_FADE;
00028     srv_.request.t=t;
00029     srv_.request.r=r;
00030     srv_.request.g=g;
00031     srv_.request.b=b;
00032     if (client_.call(srv_))
00033     {
00034       return srv_.response.on; 
00035     }
00036     else
00037     {
00038       ROS_ERROR("Failed to call Blink(1) service!");
00039       return false;
00040     }  
00041   }
00042   
00043   bool set(uint8_t r, uint8_t g, uint8_t b){
00044     srv_.request.function = BL_ON;
00045     srv_.request.t=0;
00046     srv_.request.r=r;
00047     srv_.request.g=g;
00048     srv_.request.b=b;
00049     if (client_.call(srv_))
00050     {
00051       return srv_.response.on; 
00052     }
00053     else
00054     {
00055       ROS_ERROR("Failed to call Blink(1) service!");
00056       return false;
00057     }  
00058   }
00059   
00060   bool blink(uint8_t r, uint8_t g, uint8_t b, int t){
00061     srv_.request.function = BL_BLINK;
00062     srv_.request.t=t;
00063     srv_.request.r=r;
00064     srv_.request.g=g;
00065     srv_.request.b=b;
00066     if (client_.call(srv_))
00067     {
00068       return srv_.response.on; 
00069     }
00070     else
00071     {
00072       ROS_ERROR("Failed to call Blink(1) service!");
00073       return false;
00074     }  
00075   }
00076   
00077   bool blink(int t){
00078     srv_.request.function = BL_RANDBLINK;
00079     srv_.request.t=t;
00080     srv_.request.r=0;
00081     srv_.request.g=0;
00082     srv_.request.b=0;
00083     if (client_.call(srv_))
00084     {
00085       return srv_.response.on; 
00086     }
00087     else
00088     {
00089       ROS_ERROR("Failed to call Blink(1) service!");
00090       return false;
00091     }  
00092   }
00093   
00094 };
00095 
00096 #endif


blink1
Author(s): Guilherme Pereira (The AIR lab, Carnegie Mellon University)
autogenerated on Sat Jun 8 2019 20:13:43