Hello,
I would like to initialize my robot on a map through GPS for a navigation task. How can I convert GPS coordinates to map Coordinates?
Thanks
UPDATE 1
I am using the following launch files:
<launch>
<node pkg="robot_localization" type="navsat_transform_node" name="navsat_transform_node" respawn="true">
<param name="magnetic_declination_radians" value="0"/>
<param name="roll_offset" value="0"/>
<param name="pitch_offset" value="0"/>
<param name="yaw_offset" value="0"/>
<param name="zero_altitude" value="false"/>
<remap from="/imu/data" to="/robot/imu" />
<remap from="/gps/fix" to="/robot/gps" />
<remap from="/odometry/gps" to="/initialpose" />
</node>
</launch>
Launch file for ekf_localization_node
<!-- This node will take in measurements from odometry, IMU, stamped pose, and stamped twist messages. It tracks
the state of the robot, with the state vector being defined as X position, Y position, Z position,
roll, pitch, yaw, and the respective velocites for those quantities. Accelerations are not used (yet).
Units for all measurements are assumed to be in meters and radians. By default, the node outputs an
Odometry message with the topic name odometry/filtered -->
<node pkg="robot_localization" type="ekf_localization_node" name="ekf_localization" clear_params="true">
<!-- Set initial pose of the robot through code or rviz -->
<remap from="set_pose" to="initialpose"/>
<!-- The frequency, in Hz, at which the filter will output a position estimate. Note that
the filter will not begin computation until it receives at least one message from
one of the inputs. It will then run continuously at the frequency specified here,
regardless of whether it receives more measurements. -->
<param name="frequency" value="30"/>
<!-- The period, in seconds, after which we consider a sensor to have timed out. In this event, we
carry out a predict cycle on the EKF without correcting it. This parameter can be thought of
as the minimum frequency with which the filter will generate output. -->
<param name="sensor_timeout" value="0.1"/>
<!-- The filter accepts an arbitrary number of inputs from each input message type (Odometry, PoseStamped,
TwistStamped, Imu). To add a new one, simply append the next number in the sequence to its base name,
e.g., odom0, odom1, twist0, twist1, imu0, imu1, imu2, etc. The value should be the topic name. -->
<param name="odom0" value="robot/odom"/>
<param name="imu0" value="robot/imu"/>
<!-- Each sensor reading updates some or all of the filter's state. These options give you greater control over
which values from each measurement are fed to the filter. For example, if you have an odometry message as input,
but only want to use its Z position value, then set the entire vector to false, except for the third entry.
The order of the values is x, y, z, roll, pitch, yaw, vx, vy, vz, vroll, vpitch, vyaw. Note that not some message
types lack certain variables. For example, a TwistWithCovarianceStamped message has no pose information, so the first
six values would be meaningless in that case. -->
<rosparam param="odom0_config">[false, false, true, true, true, true, true, true, true, true, true, true]</rosparam>
<rosparam param="imu0_config">[false, false, false, true, true, true, false, false, false, true, true, true]</rosparam>
<!-- The best practice for including new sensors in ekf_localization_node is to pass in velocity measurements and let
ekf_localization_node integrate them. However, this isn't always feasible, and so ekf_localization (and the other
nodes in robot_localization) support fusion of absolute measurements. If you have more than one sensor providing
absolute measurements, however, you will quickly run into problems, as the sensors will inevitably diverge from
one another, causing the filter to jump back and forth rapidly. To combat this situation, you can set the sensor's
differential parameter to true. This will carry out differential integration of the sensor data, i.e., it will
repeatedly integrate the difference between a given measurement and the previous measurement from that sensor.
NOTE: this only applies to sensors that provide absolute measurements, so Twist messages are not supported. -->
<param name="odom0_differential" value="true"/>
<param name="imu0_differential" value="true"/>
<!-- Debug settings. Not for the faint of heart. Outputs a ludicrous amount of information to the file
specified by debug_out_file. I hope you like matrices! -->
<param name="debug" value="false"/>
<param name="debug_out_file" value="debug_ekf_localization.txt"/>
<!-- For the tf tree, this specifies the name of the local (odom) and vehicle (base_link) frames. There's
a good chance you can leave these alone, as the default values adhere to the ROS spec. -->
<param name="odom_frame" value="odom"/>
<param name="base_link_frame" value="robot/base_footprint"/>
<!-- The process noise covariance matrix can be difficult to tune, and can vary for each application, so it
is exposed as a configuration parameter. PLEASE NOTE that every value in this matrix *must* be specified
as real-valued, i.e., it must have a decimal point. Integers don't load correctly. The values are ordered
as x, y, z, roll, pitch, yaw, vx, vy, vz, vroll, vpitch, vyaw. -->
<rosparam param="process_noise_covariance">[0.03, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.03, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.4, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.03, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.03, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.00, 0.06, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.00, 0.0, 0.025, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.00, 0.0, 0.0, 0.025, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.00, 0.0, 0.0, 0.0, 0.05, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.00, 0.0, 0.0, 0.0, 0.0, 0.002, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.00, 0.0, 0.0, 0.0, 0.0, 0.0, 0.002, 0.0,
0.0, 0.0, 0.0, 0.0, 0.00, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.004]</rosparam>
</node>
When I am running the move_base.launch (navigation stack), I get the following error:
[ERROR] [1416949561.233882834]: Client [/ekf_localization] wants topic /initialpose to have datatype/md5sum [geometry_msgs/PoseWithCovarianceStamped/953b798c0f514ff060a53a3498ce6246], but our version has [nav_msgs/Odometry/cd5e73d190d741a2f92e81eda573aca7]. Dropping connection.
[ERROR] [1416949561.248454412]: Client [/fake_localization] wants topic /initialpose to have datatype/md5sum [geometry_msgs/PoseWithCovarianceStamped/953b798c0f514ff060a53a3498ce6246], but our version has [nav_msgs/Odometry/cd5e73d190d741a2f92e81eda573aca7]. Dropping connection.
Originally posted by ROSCMBOT on ROS Answers with karma: 651 on 2014-11-24
Post score: 2
Original comments
Comment by dornhege on 2014-11-25:
What are map coordinates for you? What are GPS coordinates for you? What do you want to do? Might a TF link be a better choice?
Comment by ROSCMBOT on 2014-11-25:
I'm using the navigation stack, so I believe map is in the UTM frame and GPS is of type sensor_msgs/NavSatFix
message (Not sure about the coordinate frame)