Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You are not specifying what the request and response are in your service callback. You need to have the ::Request and ::Response appended to your srv (std_msgs::Float32) type:

bool set_demand(std_msgs::Float32::Request &request,std_msgs::Float32::Response &response)
{
    return true;
}

Otherwise the request and repsonce are not specified

First, you cannot use messages like that in the service callback.

You are not specifying what the request and response are in your service callback. You need to have the ::Request and ::Response appended to your srv (std_msgs::Float32) type:

bool set_demand(std_msgs::Float32::Request &request,std_msgs::Float32::Response &response)
{
    return true;
}

Otherwise the request and repsonce are not specified

First, you cannot use messages like that in the service callback.callback. You need to use a defined srv in the call. From what I can see your service should pass a std_msgs::Float32 value as request and after some processing return a std_msgs::Float32 of the same type.

You are not specifying what the request and response are in your service callback. You need to have the ::Request and ::Response appended to your srv (std_msgs::Float32) type:

bool set_demand(std_msgs::Float32::Request &request,std_msgs::Float32::Response &response)
{
    return true;
}

Otherwise the request and repsonce are not specified

First, you cannot use messages like that in the service callback. You need to use a defined srv in the call. From what I can see your service should pass a std_msgs::Float32 value as request and after some processing return a std_msgs::Float32 of the same type. Since this is not a standard service you will need to implement your own service.

You are not specifying Also note that you will need to specify what the request and response are in your service callback. You need to have the ::Request and ::Response appended to your srv (std_msgs::Float32) type:

bool set_demand(std_msgs::Float32::Request &request,std_msgs::Float32::Response set_demand(your_packet::your_custom_srv::Request &request,your_packet::your_custom_srv::Response &response)
{
    return true;
}

Otherwise the request and repsonce responce are not specified

First, you cannot use messages like that in the service callback. You need to use a defined srv in the call. From what I can see your service should pass a std_msgs::Float32 value as request and after some processing return a std_msgs::Float32 of the same type. type as responce. Since this is not a standard service you will need to implement your own service.service.

Your set_demand srv definition should look like this:

float32 x
---
float32 y

Also note that you will need to specify what the request and response are in your service callback. You need to have the ::Request and ::Response appended to your srv (std_msgs::Float32) type:

bool set_demand(your_packet::your_custom_srv::Request &request,your_packet::your_custom_srv::Response set_demand(control_bridge::set_demand::Request &request,control_bridge::set_demand::Response &response)
{
    // processing logic goes here
    return true;
}

Otherwise the request and responce are not specified

First, you cannot use messages like that in the service callback. You need to use a defined srv in the call. From what I can see your service should pass a std_msgs::Float32 value as request and after some processing return a std_msgs::Float32 of the same type as responce. Since this is not a standard service you will need to implement your own service.

Your set_demand srv definition should look like this:

float32 x
---
float32 y

Also note that you will need to specify what the request and response are in your service callback. You need to have the ::Request and ::Response appended to your srv (std_msgs::Float32) type:

bool set_demand(control_bridge::set_demand::Request &request,control_bridge::set_demand::Response &response)
{
    // processing logic goes here
    // you can access the request/responce like this request.x  responce.y
    return true;
}

Otherwise the request and responce are not specified

First, you cannot use messages like that in the service callback. You need to use a defined srv in the call. From what I can see your service should pass a std_msgs::Float32 value as request and after some processing return a std_msgs::Float32 of the same type as responce. Since this is not a standard service you will need to implement your own service.

Your set_demand srv definition should look like this:

float32 x
---
float32 y

Also note that you will need to specify what the request and response are in your service callback. You need to have the ::Request and ::Response appended to your srv (std_msgs::Float32) type:

bool set_demand(control_bridge::set_demand::Request &request,control_bridge::set_demand::Response &response)
{
    // processing logic goes here
    // you can access use here the request/responce request/response like this this: request.x  responce.y
response.y
    return true;
}

Otherwise the request and responce are not specified

First, you cannot use messages like that in the service callback. You need to use a defined srv in the call. From what I can see your service should pass a std_msgs::Float32 value as request and after some processing return a std_msgs::Float32 of the same type as responce. Since this is not a standard service you will need to implement your own service.

Your set_demand srv definition should look like this:

float32 x
---
float32 y

Also note that you will need to specify what the request and response are in your service callback. You need to have the ::Request and ::Response appended to your srv (std_msgs::Float32) type:

bool set_demand(control_bridge::set_demand::Request &request,control_bridge::set_demand::Response &response)
{
    // processing logic goes here
    // you can use here the request/response like this: request.x  response.y
    return true;
}

The msg/srv generation and creating a service server/client tutorials provide enough info on how to do this.