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

HatchEm27998's profile - activity

2021-07-26 17:15:29 -0500 received badge  Famous Question (source)
2021-04-11 09:53:47 -0500 commented answer Error calling Service in rospy

Yes, I did this just before I got your reply, and it solved the problem THANK YOU SO MUCH!

2021-04-11 09:53:02 -0500 commented answer Error calling Service in rospy

Yes I did this just before I got your reply, and it solved the problem THANK YOU SO MUCH!

2021-04-11 09:52:37 -0500 marked best answer Error calling Service in rospy

Been trying to call this Service implemented in the following code as such:

# instantiate a service server to modify the robots in gazebo
two_wheel_robot_service = rospy.Service("/morph_sim/two_wheel_robot_update", two_wheel_robot_update, twoWheelRobotUpdateCallback, (add_model_client, delete_model_client, two_wheel_robot_urdf))

The call to the service is over here:

# instantiate a service client
two_wheel_robot_update_client = rospy.ServiceProxy("/morph_sim/two_wheel_robot_update", two_wheel_robot_update)
two_wheel_robot_update_srv_msg = two_wheel_robot_updateRequest()
[...]
# prepare the service message
two_wheel_robot_update_srv_msg.update_code = 1
two_wheel_robot_update_srv_msg.add_mode = two_wheel_robot_updateRequest.ADD_MODE_RANDOM
two_wheel_robot_update_srv_msg.half_range = half_range
two_wheel_robot_update_srv_msg.position_2d = []

# THE SERVICE CALL
call_service = two_wheel_robot_update_client(two_wheel_robot_update_srv_msg)
[...]

The two_wheel_robot_update.srv file:

int32 CODE_DELETE = -1
int32 CODE_DELETE_ALL = 0
int32 CODE_ADD = 1
bool ADD_MODE_RANDOM = False
bool ADD_MODE_SPECIFIED = True
int32 update_code
bool add_mode
float64 half_range
float64[] position_2d
---
uint8 SUCCESS = 1
uint8 ADD_FAIL_NO_RESPONSE = 2
uint8 ADD_FAIL_TOO_CROWDED = 3
uint8 ADD_FAIL_OCCUPIED = 4
uint8 DELETE_FAIL_NO_RESPONSE = 5
uint8 DELETE_FAIL_EXCEED_QUANTITY = 6
uint8 FAIL_OTHER_REASONS = 7
uint8 response_code

However, I keep getting this error because of the call, no matter what I try:

Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 667, in handle
    requests = transport.receive_once()
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_base.py", line 758, in receive_once
    raise TransportException("receive_once[%s]: unexpected error %s"%(self.name, str(e)))
TransportException: receive_once[/morph_sim/two_wheel_robot_update]: unexpected error an integer is required

Please help me solve this, I have no idea what to do, I have tried everything.

2021-04-11 09:52:36 -0500 received badge  Scholar (source)
2021-04-11 09:23:43 -0500 commented answer Error calling Service in rospy

But then how am I supposed to pass the additional parameters to the service callback function?

2021-04-11 09:09:18 -0500 received badge  Notable Question (source)
2021-04-11 09:07:32 -0500 commented answer Error calling Service in rospy

This did not work, it is still giving me the same error, even if I pass an empty two_wheel_robot_updateRequest message t

2021-04-11 01:34:48 -0500 received badge  Popular Question (source)
2021-04-11 01:24:33 -0500 commented question Error calling Service in rospy

It did not work. Even when I'm giving it a value directly from the .srv file, it is still throwing me that error. I made

2021-04-10 17:35:30 -0500 asked a question Error calling Service in rospy

Error calling Service in rospy Been trying to call this Service implemented in the following code as such: # instantiat

2021-03-10 09:54:06 -0500 commented answer How do I create dynamic launch files?

Thank you so so so much for this, this solved a problem we were facing for quite a while!

2021-03-10 06:08:27 -0500 received badge  Supporter (source)