Orientation of robot in odom frame

asked 2017-04-29 05:56:26 -0500

rsmitha gravatar image

updated 2017-04-29 18:17:20 -0500

Hi,

I am running a simulation in gazebo with the jackal as my robot. I set the initial orientation by setting the following values in the quaternion for gazebo model states:

void Initialise(gazebo_msgs::ModelState &msg_value) {

msg_value.pose.position.x = 0.0;
msg_value.pose.position.y = 0.0;
msg_value.pose.position.z = 0.0;
msg_value.pose.orientation.x = 0.0;
msg_value.pose.orientation.y = 0.0;
msg_value.pose.orientation.z = 0.7; 
msg_value.pose.orientation.w = 0.7;
msg_value.model_name = "jackal";

}

The twist message values are as follows: geometry_msgs::Twist msg; msg.linear.x = abs(speed) --> speed increases from 0.0 to 2.0 and stays there.

When I run this simulation, the jackal faces north (90 degrees from its usual initial position) and moves in a straightline. The gazebo co-ordinates for the jackal show the y position increasing which is what I expected. However, the odometry positions obtained from subscribing to "nav_msgs::Odometry" show the x position increasing. This tells me that the odometry frame has not rotated by 90 degrees.

How can I rotate the odometry frame to rotate by 90 degrees and stay like that for the experiment just like the gazebo frame?

Please help.

Regards, rsmitha.

edit retag flag offensive close merge delete

Comments

Did you rotate your IMU in tf (e.g in urdf)?

Humpelstilzchen gravatar image Humpelstilzchen  ( 2017-04-30 04:18:54 -0500 )edit

@Humpelstilzchen, No, I did not. I thought the initial values should be enough for the odom frame to start at that orientation. If I have to rotate the IMU, then I can as well rotate the robot with a certain angular velocity to have it reach the required orientation and stop. Next comment....

rsmitha gravatar image rsmitha  ( 2017-04-30 04:34:56 -0500 )edit

I suppose to rotate IMU in tf, I should transform the frame with required orientation and broadcast it? I am not sure how to rotate the IMU. Can you advise?

rsmitha gravatar image rsmitha  ( 2017-04-30 04:36:08 -0500 )edit

This is very setup specific, but usually the orientation is set in the urdf file by changing the origin

Humpelstilzchen gravatar image Humpelstilzchen  ( 2017-04-30 04:46:21 -0500 )edit

But what if I have to change the orientation for each trial of my test starting afresh? I will have to have multiple urdf files to load each orientation at the start? Also, I should then be able to do the same thing in the launch file as in the urdf file?

rsmitha gravatar image rsmitha  ( 2017-04-30 04:49:59 -0500 )edit

It is a useful pointer. Thanks, @Humpelstilzchen.

rsmitha gravatar image rsmitha  ( 2017-04-30 05:05:30 -0500 )edit