ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

ROS Service Unable to load [closed]

asked 2014-07-24 10:09:51 -0500

Yeshasvi Yeshi gravatar image

updated 2014-12-05 09:14:06 -0500

thebyohazard gravatar image

I have the following code. When launched using a launch file I can see that a service is listed under rosnode info but when i try to call the service I am getting an error like

ERROR: Unable to load type [biclops/HomingSequence]. Have you typed 'make' in [biclops]?

The code was working fine few hours back and I have no clue why this is happening . Kindly help

Thank you

#include <ros/ros.h>
#include <cstdio>          // for FILE defn
#include <iostream>         // for cout, etc
#include <time.h>           // for clock_t and clock
#include <list>
#include <math.h>
#include <string>
#include <cstring>
#include <sensor_msgs/JointState.h>
#include "turtlesim/Velocity.h"
#include <biclops/HomingSequence.h>


using namespace std;
using namespace ros;

#include <Biclops.h>
#include <PMDUtils.h>


char *config_path="/home/yeshi/catkin_ws/src/biclops/BiclopsDefault.cfg";

// Defines which axes we want to use.
int axisMask=Biclops::PanMask
        + Biclops::TiltMask;;

// Pointers to each axis (populated once controller is initialized).
  PMDAxisControl *panAxis = NULL;
  PMDAxisControl *tiltAxis = NULL;

  // THE interface to Biclops
        Biclops biclops_obj;




double pan_pos_value=0;
double tilt_pos_value=0;

double pan_joint_pos=0;
double tilt_joint_pos=0;

PMDAxisControl::Profile panProfile,tiltProfile;


ros::Subscriber key_sub;
ros::Publisher joint_pub;
ros::ServiceServer homing_service;
sensor_msgs::JointState joint_state;


void keyCallback(turtlesim::Velocity vel){

    cout<<"Inside The Callback"<<endl;



    if(vel.angular==-2){


        pan_pos_value=pan_pos_value+5;

        panProfile.pos = PMDUtils::DegsToRevs(pan_pos_value);
        cout<<"Pan POSITION in Degrees : "<<pan_pos_value<<endl;
        cout<<"Pan POSITION in revs : "<<panProfile.pos<<endl;
        panAxis->SetProfile(panProfile);
        panAxis->Move();

    }

    if(vel.angular==2){

            pan_pos_value=pan_pos_value-5;
            panProfile.pos = PMDUtils::DegsToRevs(pan_pos_value);
            cout<<"Pan POSITION in Degrees : "<<pan_pos_value<<endl;
            cout<<"Pan POSITION in revs : "<<panProfile.pos<<endl;
            panAxis->SetProfile(panProfile);
            panAxis->Move();

        }

    if(vel.linear==2){

            tilt_pos_value=tilt_pos_value+5;
            tiltProfile.pos = PMDUtils::DegsToRevs(tilt_pos_value);
            cout<<"Tilt POSITION in Degrees : "<<tilt_pos_value<<endl;
            cout<<"Tilt POSITION in revs : "<<tiltProfile.pos<<endl;
            tiltAxis->SetProfile(tiltProfile);
            tiltAxis->Move();

        }

    if(vel.linear==-2){

                tilt_pos_value=tilt_pos_value-5;
                tiltProfile.pos = PMDUtils::DegsToRevs(tilt_pos_value);
                cout<<"Tilt POSITION in Degrees : "<<tilt_pos_value<<endl;
                cout<<"Tilt POSITION in revs : "<<tiltProfile.pos<<endl;
                tiltAxis->SetProfile(tiltProfile);
                tiltAxis->Move();

            }


    //Assign the joint positions to the position values variables
    pan_joint_pos=panProfile.pos;
    tilt_joint_pos=tiltProfile.pos;

        joint_state.header.stamp = ros::Time::now();
        joint_state.name.resize(2);
        joint_state.position.resize(2);
        joint_state.name[0] ="PAN_JOINT";
        joint_state.position[0] = pan_joint_pos;
        joint_state.name[1] ="TILT_JOINT";
        joint_state.position[1] = -tilt_joint_pos;

        //send the joint state
        joint_pub.publish(joint_state);


}

bool Homing(biclops::HomingSequence::Request &req,
             biclops::HomingSequence::Request &res){

    ROS_INFO("Performing Homing Sequence");
    biclops_obj.HomeAxes(axisMask,true);

    pan_pos_value=0;
    tilt_pos_value=0;

    pan_joint_pos=0;
    tilt_joint_pos=0;

    return true;
}


//----------------------------------------------------------------------------
int main (int argc, char *argv[]) {

   ros::init(argc,argv,"Biclops");
   ROS_INFO("node creation");
   ros::NodeHandle nh;
   ros::Rate loop_rate(10);


      // ROS_INFO("ARGV : %s ",argv[1]);
    //argv[1]="/home/yeshi/catkin_ws/src/biclops/BiclopsDefault.cfg";
      argv[1]=config_path;
    ROS_INFO( "\n\nBasic Biclops Running Example\n\n" );
    //Initializing

        cout<<"Initialization Routine"<<biclops_obj.Initialize(argv[1])<<endl;

    if (!biclops_obj.Initialize(argv[1]))
    {

        ROS_INFO( "Failed to open Biclops Communication\n" );
        ROS_INFO( "Press Enter key to terminate...\n" );
        getchar();
        //return 0;
    }
    else
            ROS_INFO( "Succeed to open Biclops Communication\n" );



    //Subscribing
    key_sub=nh.subscribe ...
(more)
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2015-03-02 18:24:52.850853

1 Answer

Sort by ยป oldest newest most voted
3

answered 2014-12-05 09:17:04 -0500

thebyohazard gravatar image

What does

echo $ROS_PACKAGE_PATH

output? I'd guess that your service isn't being found because your path got changed. Try re-sourcing the setup file in your ros workspace.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2014-07-24 10:09:51 -0500

Seen: 4,731 times

Last updated: Dec 05 '14