Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rosserial_python : Service handler returned None #408

Open
michalrom089 opened this issue Dec 18, 2018 · 7 comments · May be fixed by #414
Open

rosserial_python : Service handler returned None #408

michalrom089 opened this issue Dec 18, 2018 · 7 comments · May be fixed by #414

Comments

@michalrom089
Copy link

michalrom089 commented Dec 18, 2018

I've setup service server on stm32 :

ros::NodeHandle nh;

void srv_callback(const custom_srv::AddTwoIntsRequest &req, custom_srv::AddTwoIntsResponse &res){
	res.Sum = 2;
}

ros::ServiceServer<custom_srv::AddTwoIntsRequest,custom_srv::AddTwoIntsResponse> server("add_two_ints",&srv_callback);

void setup(){
	nh.initNode();
	nh.advertiseService(server);
}
void loop(void)
{
	nh.spinOnce();
}

But when I try to call the service from rosserial_python error occurs :

$rosservice call /add_two_ints "A: 0
B: 0" 
ERROR: service [/add_two_ints] responded with an error: service cannot process request: service handler returned None

I tried to debug this error on stm32. Apparently, the error occurs befor computing srv_callback(). I assume that this is related with rosserial_python package but it's onyl guessing.

@jimmyshe
Copy link

jimmyshe commented Dec 20, 2018

Try version 7.7.0. The older version does not have this problem.
I was facing the same issue, using arduino due and 8.0.0 version of rosserial.

/*
 * rosserial Service Server
 */

#include <ros_m.h>
#include <std_msgs/String.h>
#include <rosserial_arduino/Test.h>

ros::NodeHandle  nh;
using rosserial_arduino::Test;

int i;
void callback(const Test::Request & req, Test::Response & res){
  if((i++)%2)
    res.output = "hello";
  else
    res.output = "world";
}

ros::ServiceServer<Test::Request, Test::Response> server("test_srv",&callback);

std_msgs::String str_msg;
ros::Publisher chatter("chatter", &str_msg);

char hello[13] = "hello world!";

void setup()
{
  nh.initNode();
  nh.advertiseService(server);
  nh.advertise(chatter);
}

void loop()
{
  str_msg.data = hello;
  chatter.publish( &str_msg );
  nh.spinOnce();
  delay(10);
}
$rosservice call /test_srv "input: 'sssss'"
ERROR: service [/test_srv] responded with an error: service cannot process request: service handler returned None

maartendemunck added a commit to Vijfendertig/rosserial_servo_controller that referenced this issue Dec 30, 2018
Rosserial 0.8.0 appears to have problems with services (see
ros-drivers/rosserial#408), so configuration
is currently implemented as a subscriber rather than as a service.
@doisyg
Copy link

doisyg commented Jan 17, 2019

Same issue with arduino Uno, Ros Melodic and last version of the binary package.

@betab0t
Copy link

betab0t commented Jan 20, 2019

Hi all,

Did some tests with my Arduino Mega 2560 and Melodic... 0.7.7 works fine while 0.8.0 returns service handler returned None...

After trying different versions in between 0.7.7-0.8.0 I can tell that this issue was introduced in fe1e233.

@Tones29
Copy link

Tones29 commented Jan 24, 2019

I got the same issue with an Arduino Micro: 0.7.7 is working, 0.8.0 responds with the error.

doisyg referenced this issue Feb 7, 2019
* Added hard_reset service call to serial_node

* Refactored SerialClient to use a write thread, working around deadlock when both Arduino and serial_node.py get stuck writing to each other.

* Updated cmakelists and package.xml to include dependencies. Removed unnecessary tcp functionality from arduino-specific serial_node.py
@doisyg
Copy link

doisyg commented Feb 7, 2019

@chrisspen and @mikepurvis
Since @betab0t seems to have identified the bug from the PR fe1e233 , do you see a way to fix it?

@lenzc lenzc linked a pull request Feb 26, 2019 that will close this issue
@lenzc
Copy link

lenzc commented Feb 26, 2019

I proposed a fix in #414.

@camisatx
Copy link

camisatx commented May 27, 2020

Any updates on getting #414 merged? Replacing the rosserial_python/SerialClient.py with the 0.7.7 version appears to work, but feels hacky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants