Turn angle not same on actual robot and Rviz

598 views
Skip to first unread message

MANUJ KUSHWAHA

unread,
Sep 22, 2018, 6:15:27 AM9/22/18
to LINOROBOT
Hey my robot moves forward and backwards perfectly and with the same distance also in actual and Rviz but on turning the bot turns around 90 degrees while Rviz shows that it has turned only 30 degrees.

I have a 2WD Kinect configuration and have edited the distance between the left and right wheels. Is there something that I am missing?

Juan Miguel Jimeno

unread,
Sep 22, 2018, 12:45:43 PM9/22/18
to LINOROBOT
Hi,

Can you post your config file here?

Thanks

MANUJ KUSHWAHA

unread,
Sep 22, 2018, 7:18:42 PM9/22/18
to LINOROBOT
Sure, this is my edited lino_base_config.h file:


lino_base_config.h

MANUJ KUSHWAHA

unread,
Sep 22, 2018, 7:29:34 PM9/22/18
to LINOROBOT
My actual robot has two wheels mounted at each sides of a circular disc and two castor wheels at the front and back. Do i also need to modify the kinematics file or make some changes in the URDF for this discrepancy in the degree of turn?

MANUJ KUSHWAHA

unread,
Sep 22, 2018, 7:32:19 PM9/22/18
to LINOROBOT

Screenshot_20180923-050033__01.jpg

This is an image of my bot:

Juan Miguel Jimeno

unread,
Sep 23, 2018, 7:38:53 AM9/23/18
to LINOROBOT
Hi have you configured use_mag in: https://github.com/linorobot/linorobot/blob/master/launch/include/imu/imu.launch#L11 to false since you’re using MPU6050?

MANUJ KUSHWAHA

unread,
Sep 24, 2018, 3:15:07 AM9/24/18
to LINOROBOT
Yes I have configured that line to false from the start.
Is the magnetometer value required/necessary ie. will i get more accurate odometry by using a MPU-9050 or MPU-9250
What else can i do to rectify this problem?

MANUJ KUSHWAHA

unread,
Sep 24, 2018, 3:21:12 AM9/24/18
to LINOROBOT
Also I have attached the IMU at the centre of the robot, is this the correct position?
Thanks

Juan Miguel Jimeno

unread,
Sep 24, 2018, 3:44:23 AM9/24/18
to lino...@googlegroups.com
Hey,

Can you move the robot around and  move back to the starting position? If somehow it closes the loop, your odometry should be okay.

Would be great if you can post the graph of your odometry test too. Does the angular velocity being published in raw_vel matches the required velocity in teleop?

MANUJ KUSHWAHA

unread,
Sep 24, 2018, 6:02:59 AM9/24/18
to LINOROBOT
No i cannot move it in a closed loop simultaneously in Rviz and in real.
The Z angular velocity is not exactly the same as in /odom as it is in teleop keyboard, it is less in /odom, and if i reduce it in teleop then the velocity in /odom reduces further.

This is the image of the me giving the commamd to move forward then backward, I have drawn the actual motion of the robot in yellow on the image.
imageedit_2_4442625124.jpg

Juan Miguel Jimeno

unread,
Sep 24, 2018, 6:58:25 AM9/24/18
to LINOROBOT
Can you post a screenshot of your terminals subscribed to raw_vel (rostopic echo raw_vel) and cmd_vel (rostopic echo cmd_vel). Just want to check if the angular velocity reported by the encoder roughly matches the required angular speed.

MANUJ KUSHWAHA

unread,
Sep 24, 2018, 7:05:02 AM9/24/18
to LINOROBOT
What I did to trouble-shoot was i picked up the robot and turned it 90 degrees and in Rviz it turned by some 20 degrees, so I changed the line in Imu.h to :

gyro.z = (-6.6)*gz * (double) GYRO_SCALE * DEG_TO_RAD;

The negative in sign is due to the fact that i have mounted the gyroscope in inverted position.
The factor 6.6 is for getting the same degree of turn

But now it move in a straight line when going forward but moves in a circular arc when moving backwards.

What more can i do to troubleshooot?



MANUJ KUSHWAHA

unread,
Sep 24, 2018, 7:28:51 AM9/24/18
to LINOROBOT
I am attaching a screenshot

The topic /raw_vel is at the top left
The topic /cmd_vel is at bottom left
and teleop keyboard is at right

The sign of the angular velocity is opposite but i have changed the imu z axis data to be negative in the imu.h file, 
gyro.z = (-6.6)*gz * (double) GYRO_SCALE * DEG_TO_RAD

The first file is of the start when raw vel has not yet reavhed cmd_vel, the second one is when the required velocity is achieved.
Screenshot from 2018-09-24 16-49-21.png
Screenshot from 2018-09-24 16-48-22.png

Juan Miguel Jimeno

unread,
Sep 24, 2018, 7:38:19 AM9/24/18
to LINOROBOT
That explains the problem. You don’t have to tweak the firmware. You can set the IMU orientation using static_transform_publisher https://github.com/linorobot/linorobot/blob/master/launch/include/imu/imu.launch#L20. You can set the IMU’s orientation using the last three numbers (yaw pitch roll). The idea is with 0,0,0 as default yaw, pitch and roll, how much rotation is needed in each axis to attain your IMU’s current orientation in radians.

Here’s the full API documentation (6.3): http://wiki.ros.org/tf#static_transform_publisher

Juan Miguel Jimeno

unread,
Sep 24, 2018, 7:47:57 AM9/24/18
to LINOROBOT
If you’re still following the arrows in your IMU (x facing the front) with the IMU inverted, it should be 0 0 0 0 0 3.1416 since you’re rotating it 180 degrees in the x axis (roll). I don’t have my robot with me to verify thus but you can give it a try. ;)

MANUJ KUSHWAHA

unread,
Sep 24, 2018, 7:53:57 AM9/24/18
to LINOROBOT
Okay I will try this and update you with the progress tomorrow.
Thanks

MANUJ KUSHWAHA

unread,
Sep 25, 2018, 5:44:36 AM9/25/18
to LINOROBOT
Hey Juan, I changed the roll value of IMU in Imu.launch file and the direction of turn is now correct and the turn angle is also correct now when turning but the bot is now not moving straight,

when giving the command to move staright the bot first turns a bit towards left, moves in that direction and then when i stop turning it turns a bit to the right to correct the initial turn, but it has moved at an angle throughout so this correction doesn't help.
Is this a problem with how PID is configured? or should i somehow give different PID values for both motors?
Reply all
Reply to author
Forward
0 new messages