Initialising /odom
Hi,
I read this discussion on answers.ros: http://answers.ros.org/question/235228/how-is-the-orientation-of-frame-odom-initialized/
What I understand is that, "/odom" takes its initial orientation from the "IMU". So if I publish a certain orientation in quarternion to "sensor_msgs::Imu" I should be able initialise the "odom" frame to start in that direction.
I did the following:
void Initialise(sensor_msgs::Imu &msg_value)
{
msg_value.header.stamp = ros::Time::now();
msg_value.header.frame_id = "/odom";
msg_value.angular_velocity.x = 0.0;
msg_value.angular_velocity.y = 0.0;
msg_value.angular_velocity.z = 0.0;
msg_value.linear_acceleration.x = 0.0;
msg_value.linear_acceleration.y = 0.0;
msg_value.linear_acceleration.z = 0.0;
msg_value.orientation.x = 0.0;
msg_value.orientation.y = 1.0;
msg_value.orientation.z = 0.0;
msg_value.orientation.w = 0.0;
}
int main(int argc, char** argv)
{
blah....
geometry_msgs::Twist msg;
geometry_msgs::PoseWithCovarianceStamped msg_setpose;
nav_msgs::Odometry nav_msg;
sensor_msgs::JointState jt_msg;
gazebo_msgs::SetModelState set_model_state;
gazebo_msgs::ModelState model_state;
sensor_msgs::Imu msg_imu;
ros::NodeHandle nh;
ros::init(argc, argv, "random_commands");
ros::Publisher pub_imu=nh.advertise<sensor_msgs::Imu>("imu/data", 100);
Initialise(msg_imu);
pub_imu.publish(msg_imu);
ros::Rate rate(10);
srand(time(0));
while(ros::ok()) {
//give speed
//check distance
....blah..
rate.sleep();
}
ros::spin();
return 0;
}
All headers have been included and the code compiles. I subscribe to "navmsgs::Odometry" which I think uses, "geometrymsgs::Pose", to get the odometry data with respect to position and orientation. Speed is being fed in the x direction through the "cmd_vel" topic.
What I expected to see: I expected the odom frame to be initialised as per the IMU data. So I expected the robot to turn by 90degrees in the odom frame and start moving as speed came in. I expected to see the odometry data to show increase in the 'y' direction. But this does not seem to be the case.
The ekf_localisation is part of the jackal-ros pakage I think. What am I doing wrong? Is my understanding wrong?
Please help.
Regards, rsmitha.
Asked by rsmitha on 2017-04-29 18:36:10 UTC
Comments
Did you fix that? I am trying to get Odom from PoseWithCovarianceStamped...
Asked by Andreluizfc on 2018-02-12 17:32:02 UTC
Hi @Andreluizfc, I was trying to get the simulated jackal to start a particular orientation. However, I did not make the changes which were part of the https://answers.ros.org/question/235228/how-is-the-orientation-of-frame-odom-initialized/. Please see next comment.
Asked by rsmitha on 2018-02-12 18:22:33 UTC
I was not using the fused data from ekf_localisation/robot_localisation packages. The idea was for me to be just able to orient the robot the way I wanted. Are you trying that? Please see next comment.
Asked by rsmitha on 2018-02-12 18:23:38 UTC
If you just trying to use PoseWithCovarianceStamped, you should be able to subscribe to it and get your odom data. That works.
Asked by rsmitha on 2018-02-12 18:25:22 UTC
Ohhh. Seems nice! Thanks for the tip!
Asked by Andreluizfc on 2018-02-13 15:35:00 UTC