0
$\begingroup$

Rosanswers logo

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!


Originally posted by Zero on ROS Answers with karma: 104 on 2016-06-14

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by janindu with karma: 849 on 2016-06-14

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Zero on 2016-06-14:
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.

Comment by Zero on 2016-06-14:
0 bytes were received. Please check sender for additional details.

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

Comment by janindu on 2016-06-15:
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?

Comment by Zero on 2016-06-15:
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.

Comment by Zero on 2016-06-15:
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.

Comment by janindu on 2016-06-15:
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.

Comment by Zero on 2016-06-15:
it shows that TypeError: wait_for_server() got an unexpected keyword argument 'time'

Comment by janindu on 2016-06-15:
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))

Comment by Zero on 2016-06-15:
oh! I found the problem! I had to change the time=rospy.Duration(10.0) to timeout=rospy.Duration(10.0). And yes, you are right! I should not comment that line, that line had his purpose! Thank you so much!

Comment by janindu on 2016-06-15:
No worries. Is everything sorted now?

Comment by Zero on 2016-06-15:
Yes! you are right! I made a silly mistake! thank you for your patiently explained and solved my problem!

Comment by Zero on 2016-06-15:
yes, now should be fine.

Comment by Zero on 2016-06-15:
Hi, janindu. Would you mind give your email address to me? You look so good in this area. So if I had any Baxter relate question I can direct ask you. That will save my life.

Comment by janindu on 2016-06-15:
Hey Zero, to be frank I'm a beginner myself. I only heard about ROS in March 2016 (yep, I'm that new) when I started my PhD. And I didn't answer any Baxter related questions here either. But yeah I'm always willing to help. [email protected]

Comment by Zero on 2016-06-15:
oh...I see. But your explain and answer was really useful for me. I really appreciate it!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.