Ask Your Question
0

Problems modifying teleop_base_keyboard.

asked 2012-02-27 03:08:27 -0500

jlo gravatar image

Hey there, I wanted to try out a code that sends Twist/cmd_vel parameters over a topic. Therefore, I tried simplifying the code for teleop_base_keyboard (available here) with this code.

When I run it, instead of just taking in my keystrokes and not displaying them on screen, it does and I have to push enter to see the printf on what's being sent (right after the chatter_pub.publish(cmdvel); line). And even then, the values never change. I get the feeling it's never entering in any cases apart from the default one. What's displayed is:

Reading from keyboard
---------------------------
w/x : increase/decrease max linear speed by 10%
e/c : increase/decrease max angular speed by 10%
---------------------------
anything else : stop
---------------------------
wwww
The speed information sent is: 
 Linear speed x 0.000000  
  Angular speed z 0.000000  
w
 The speed information sent is: 
 Linear speed x 0.000000  
  Angular speed z 0.000000  
 The speed information sent is: 
 Linear speed x 0.000000  
  Angular speed z 0.000000

Any input on what I'm doing wrong?

Thanks :)!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-02-27 04:02:34 -0500

DimitriProsser gravatar image

Based on your code, it's never going to send command messages. Only your default case sets "dirty" to true. That means that you will only issue commands if you reach the default case. And in the default case, speed and turn are zero, so multiplying speed and max_speed will always result in zero.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-02-27 03:08:27 -0500

Seen: 93 times

Last updated: Feb 27 '12