Out of control cmd_vel

102 views
Skip to first unread message

Pito Salas

unread,
Jan 23, 2021, 11:04:05 AM1/23/21
to LINOROBOT
I've built a new robot, and I believe I have all the software installed correctly. I was able to callibrate the IMU, run minimal.launch. While this is a new robot for me I am very familiar wth ROS.

Whenever the robot receives a command to move, the wheels run very fast and after the first /cmd_vel it does not respond to any additional ones. On the assumption that some of my pinouts were incorrect I reversed the motor direction pins, and I also tried reversing the encoders. But the problem persists. Here is the output from minimal. Those numbers look suspect but I don't know what they mean.

Once I send the first cmd_vel (either via the teleop script or rostopic pub) I see the following output. And no amount of additional cmd_vels, with speeds set to zero, will stop the spinning. I have to power off.

Can you help me figure out what is wrong? Thanks!

[INFO] [1611417374.071803]: Encoder RearRight  : 0
[INFO] [1611417374.277823]: Encoder FrontLeft  : 679840
[INFO] [1611417374.281453]: Encoder FrontRight : -681316
[INFO] [1611417374.285495]: Encoder RearLeft   : 0
[INFO] [1611417374.289098]: Encoder RearRight  : 0
[INFO] [1611417374.496340]: Encoder FrontLeft  : 681210
[INFO] [1611417374.501486]: Encoder FrontRight : -682698
[INFO] [1611417374.506152]: Encoder RearLeft   : 0
[INFO] [1611417374.510884]: Encoder RearRight  : 0
[INFO] [1611417374.714882]: Encoder FrontLeft  : 682579
[INFO] [1611417374.719173]: Encoder FrontRight : -684080
[INFO] [1611417374.723595]: Encoder RearLeft   : 0
[INFO] [1611417374.728066]: Encoder RearRight  : 0
[INFO] [1611417374.933741]: Encoder FrontLeft  : 683948
[INFO] [1611417374.938679]: Encoder FrontRight : -685462
[INFO] [1611417374.942401]: Encoder RearLeft   : 0
[INFO] [1611417374.946195]: Encoder RearRight  : 0
[INFO] [1611417375.151942]: Encoder FrontLeft  : 685318
[INFO] [1611417375.157373]: Encoder FrontRight : -686844
[INFO] [1611417375.161392]: Encoder RearLeft   : 0
[INFO] [1611417375.165274]: Encoder RearRight  : 0
[INFO] [1611417375.371809]: Encoder FrontLeft  : 686687
[INFO] [1611417375.376137]: Encoder FrontRight : -688228
[INFO] [1611417375.379986]: Encoder RearLeft   : 0
[INFO] [1611417375.383901]: Encoder RearRight  : 0
[INFO] [1611417375.590633]: Encoder FrontLeft  : 688058
[INFO] [1611417375.594883]: Encoder FrontRight : -689611
[INFO] [1611417375.598370]: Encoder RearLeft   : 0
[INFO] [1611417375.602425]: Encoder RearRight  : 0
[INFO] [1611417375.809028]: Encoder FrontLeft  : 689428
[INFO] [1611417375.813647]: Encoder FrontRight : -690994
[INFO] [1611417375.817237]: Encoder RearLeft   : 0
[INFO] [1611417375.820785]: Encoder RearRight  : 0
[INFO] [1611417376.028545]: Encoder FrontLeft  : 690798
[INFO] [1611417376.033642]: Encoder FrontRight : -692376
[INFO] [1611417376.037465]: Encoder RearLeft   : 0
[INFO] [1611417376.041365]: Encoder RearRight  : 0
[INFO] [1611417376.247802]: Encoder FrontLeft  : 692166
[INFO] [1611417376.252402]: Encoder FrontRight : -693757
[INFO] [1611417376.256212]: Encoder RearLeft   : 0
[INFO] [1611417376.260079]: Encoder RearRight  : 0
[INFO] [1611417376.466706]: Encoder FrontLeft  : 693536
[INFO] [1611417376.471168]: Encoder FrontRight : -695139

tle...@gmail.com

unread,
Jan 23, 2021, 10:27:07 PM1/23/21
to LINOROBOT
I had the same problem with the motors and it all being boiled down to encoder wiring and PID tuning. I would try to change the PID to a very low number (there is a sub in here on how to do that) and see if that does anything. I have a strong suspicion this is probably just a pin issue. The encoder reading from minimum look like that both motors goes off in opposite direction when you press any movement.  Try just focusing on fixing one motor at a time.  Change just encoder of the front left around and see what happened. Just with minimum running, manually spin the wheel and see if the encoder read anything. You can also run rqt and under plugins and robots tool you can open the robot steering for a GUI robot control. I don't know what microcontroller you are using but verify that the associated pin has digital/analog.

jime...@gmail.com

unread,
Jan 24, 2021, 11:15:15 AM1/24/21
to LINOROBOT
Hey Pito,

The best way to troubleshoot this is to check both the encoder readings and direction of the wheels while driving the robot forward:
Encoder - The (left/right) encoder should keep increasing as you drive forward. Otherwise, you might need to swap the encoder pins.
Wheel Direction - Observe whether both wheels are rotating towards the right direction when moving the robot forward.  Otherwise, you might need to swap the motor driver pins.

To gain more intuition, this normally happens when the PID controller thinks that the wheel is rotating towards the wrong direction and tries to output high speed compensations to keep up with the target point. This will keep going until the motor reaches the max RPM. 

Reply all
Reply to author
Forward
0 new messages