~shadowrobot/sr-ros-interface-ethercat/electric

« back to all changes in this revision

Viewing changes to cyberglove/src/cyberglove_service.cpp

  • Committer: Ugo Cupcic
  • Date: 2012-08-08 10:17:21 UTC
  • mfrom: (1.1.552 shadow_robot_ethercat)
  • Revision ID: ugo@shadowrobot.com-20120808101721-lutmwmwmt06srqya
1.0.0 stable release for the etherCAT hardware

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <ros/ros.h>
2
 
 
3
 
#include <string>
4
 
#include <sstream>
5
 
 
6
 
#include "cyberglove/serial_glove.h"
7
 
#include "cyberglove/cyberglove_publisher.h"
8
 
#include "cyberglove/cyberglove_service.h"
9
 
 
10
 
using namespace ros;
11
 
 
12
 
namespace cyberglove_service{
13
 
 
14
 
CybergloveService::CybergloveService(cyberglove_publisher::CyberglovePublisher *publish)
15
 
 :  node("~"), pub(publish)
16
 
{
17
 
 
18
 
  service = node.advertiseService("start",&CybergloveService::start,this);
19
 
  service = node.advertiseService("calibration", &CybergloveService::calibration, this);
20
 
  ROS_INFO("Listening for service");
21
 
}
22
 
 
23
 
bool CybergloveService::start(cyberglove::Start::Request &req, cyberglove::Start::Response &res){
24
 
    ROS_INFO("Start");
25
 
    this->pub->cyberglove_pub.shutdown();
26
 
    return true;
27
 
}
28
 
bool CybergloveService::calibration(cyberglove::Calibration::Request &req, cyberglove::Calibration::Response &res){
29
 
    this->pub->isPublishing = false;
30
 
    this->pub->initialize_calibration(req.path);
31
 
    this->pub->isPublishing = true; 
32
 
    return true;
33
 
}
34
 
}