Robotics StackExchange | Archived questions

Orientation of robot in odom frame

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(gazebomsgs::ModelState &msgvalue) {

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.

Asked by rsmitha on 2017-04-29 05:56:26 UTC

Comments

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

Asked by Humpelstilzchen on 2017-04-30 04:18:54 UTC

@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....

Asked by rsmitha on 2017-04-30 04:34:56 UTC

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?

Asked by rsmitha on 2017-04-30 04:36:08 UTC

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

Asked by Humpelstilzchen on 2017-04-30 04:46:21 UTC

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?

Asked by rsmitha on 2017-04-30 04:49:59 UTC

It is a useful pointer. Thanks, @Humpelstilzchen.

Asked by rsmitha on 2017-04-30 05:05:30 UTC

Answers