Oct-30-2021, 02:42 PM
(This post was last modified: Oct-30-2021, 02:44 PM by Yoriz.
Edit Reason: Added code tags
)
I would like to control a robot using pexpect. Here is my code:
The script is working fine till the end. Finally the script is closing with an error related with the timeout and eof. How to resolve this error? Please, help!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
#!/usr/bin/env python from pexpect import pxssh import pexpect s = pxssh.pxssh() s.login( 'ubiquityrobot.local' , 'ubuntu' , 'ubuntu' ) print 'Start' s.sendline( 'rosrun simple_nav control.py' ) s.prompt() print (s.before) s.expect( 'Load Path Name?' , timeout = 5 ) s.sendline( 'yes' ) s.prompt() print (s.before) s.expect( 'Enter the name of the Path:' , timeout = 5 ) s.sendline( '4' ) s.prompt() print (s.before) s.expect( 'Load Path Name? ' ) s.sendline( 'no' ) s.prompt() print (s.before) s.logout() |