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

TypeError: stop() takes exactly 3 arguments (1 given)

asked 2016-06-14 06:21:03 -0500

Zero gravatar image

updated 2016-06-14 06:23:47 -0500

Hi everyone,

Currently, I'm trying to modify the baxter Joint Trajectory Client to direct use the left arm to perform the hard-coded position, instead of asking the user to add in the argument to choose the arms. After I done my modification and run the code it shows me : TypeError: stop() takes exactly 3 arguments (1 given) *

Of course, I had run the server node at same time.

It's there any part of my program was wrong or it's due to the server node was required to get the argument at the same time?

This is the example in the Baxter wiki. And this is my program node link:https: //drive.google.com/open?id=0B6JF01xXRuNbZ0JqWG1WMGNsUWM

Thank you!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-06-14 22:35:11 -0500

janindu gravatar image

updated 2016-06-14 22:36:50 -0500

Quoting rospy documentation,

rospy.on_shutdown(h)

Register handler to be called when rospy process begins shutdown. h is a function that takes no arguments. You can request a callback using rospy.on_shutdown() when your node is about to begin shutdown. This will be invoked before actual shutdown occurs, so you can perform service and parameter server calls safely. Messages are not guaranteed to be published.

Isn't your callback method expecting 3 arguments (self, position, time)? But the method h() takes no arguments (argument self is provided).

When the callback is called, the TypeError is thrown because the callback method is called is called with insufficient number of arguments. And I'm not sure you need those two arguments because you don't use them inside the method anyway.

Inside the Trajectory class, check the stop() definition to this :

def stop (self):
        self._client.cancel_goal()

It will solve the problem.

edit flag offensive delete link more

Comments

Hi Janindu, You answer work for me, and I'm able to run my core.But it just didn't form the position. At my service running terminal it shows :[WARN] [WallTime: 1465966247.239178] Inbound TCP/IP connection failed: connection from sender terminated before handshake header received.

Zero gravatar image Zero  ( 2016-06-14 23:55:50 -0500 )edit

0 bytes were received. Please check sender for additional details.

So this is mean that my program didn't send out the data?

Zero gravatar image Zero  ( 2016-06-14 23:56:49 -0500 )edit
1

In your ylj_joint_traTest.py, you have commented the following line.

#server_up = self._client.wait_for_server(time=rospy.Duration(10.0))#Blocks until the action server connects to this client.

What's the reason behind that?

janindu gravatar image janindu  ( 2016-06-15 00:38:28 -0500 )edit

this line was not using in my program, that line was used to check the server up if I put in the try to take out the error.

Zero gravatar image Zero  ( 2016-06-15 00:55:30 -0500 )edit

in the actual example there they use this to check the error. So since I done need to take out the error, I just don't use it.

Zero gravatar image Zero  ( 2016-06-15 00:56:56 -0500 )edit
1

I think you need that test. self._client.wait_for_server() will block until the action server connects to this client. The error you see now looks like a connection error. I suggest you uncomment it and check for error. At least it will give us more information.

janindu gravatar image janindu  ( 2016-06-15 01:06:20 -0500 )edit

it shows that TypeError: wait_for_server() got an unexpected keyword argument 'time'

Zero gravatar image Zero  ( 2016-06-15 01:25:57 -0500 )edit
1

I think you have it as

server_up = self._client.wait_for_server(time=rospy.Duration(10.0))

It should be

server_up = self._client.wait_for_server(timeout=rospy.Duration(10.0))
janindu gravatar image janindu  ( 2016-06-15 01:28:50 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-06-14 06:21:03 -0500

Seen: 1,323 times

Last updated: Jun 14 '16