2 #include "rosabridge_msgs/Odometry.h" 3 #include "rosabridge_msgs/OdometryCovariances.h" 4 #include "rosabridge_msgs/RequestOdometryCovariances.h" 6 #include <nav_msgs/Odometry.h> 16 ROS_INFO(
"Received SIGINT signal, shutting down...");
27 void odom_callback(
const rosabridge_msgs::Odometry::ConstPtr& odomMsg);
59 ROS_INFO_STREAM(
"base_frame: " << base_frame);
61 ROS_INFO_STREAM(
"odom_topic: " << odom_topic);
73 trans_msg.header.stamp = odomMsg->header.stamp;
77 trans_msg.header.frame_id = odomMsg->header.frame_id;
81 trans_msg.child_frame_id = odomMsg->child_frame_id;
82 trans_msg.transform.translation.x = odomMsg->pose.position.x;
83 trans_msg.transform.translation.y = odomMsg->pose.position.y;
84 trans_msg.transform.translation.z = odomMsg->pose.position.z;
85 trans_msg.transform.rotation.x = odomMsg->pose.orientation.x;
86 trans_msg.transform.rotation.y = odomMsg->pose.orientation.y;
87 trans_msg.transform.rotation.z = odomMsg->pose.orientation.z;
88 trans_msg.transform.rotation.w = odomMsg->pose.orientation.w;
92 odom_msg.header.stamp = odomMsg->header.stamp;
96 odom_msg.header.frame_id = odomMsg->header.frame_id;
100 odom_msg.child_frame_id = odomMsg->child_frame_id;
101 odom_msg.pose.pose.position.x = odomMsg->pose.position.x;
102 odom_msg.pose.pose.position.y = odomMsg->pose.position.y;
103 odom_msg.pose.pose.position.z = odomMsg->pose.position.z;
104 odom_msg.pose.pose.orientation.x = odomMsg->pose.orientation.x;
105 odom_msg.pose.pose.orientation.y = odomMsg->pose.orientation.y;
106 odom_msg.pose.pose.orientation.z = odomMsg->pose.orientation.z;
107 odom_msg.pose.pose.orientation.w = odomMsg->pose.orientation.w;
108 odom_msg.twist.twist.linear.x = odomMsg->twist.linear.x;
109 odom_msg.twist.twist.linear.y = odomMsg->twist.linear.y;
110 odom_msg.twist.twist.linear.z = odomMsg->twist.linear.z;
111 odom_msg.twist.twist.angular.x = odomMsg->twist.angular.x;
112 odom_msg.twist.twist.angular.y = odomMsg->twist.angular.y;
113 odom_msg.twist.twist.angular.z = odomMsg->twist.angular.z;
114 odom_msg.pose.covariance[0] = odomMsg->pose_covariance[0];
115 odom_msg.pose.covariance[7] = odomMsg->pose_covariance[1];
116 odom_msg.pose.covariance[14] = odomMsg->pose_covariance[2];
117 odom_msg.pose.covariance[21] = odomMsg->pose_covariance[3];
118 odom_msg.pose.covariance[28] = odomMsg->pose_covariance[4];
119 odom_msg.pose.covariance[35] = odomMsg->pose_covariance[5];
120 odom_msg.twist.covariance[0] = odomMsg->twist_covariance[0];
121 odom_msg.twist.covariance[7] = odomMsg->twist_covariance[1];
122 odom_msg.twist.covariance[14] = odomMsg->twist_covariance[2];
123 odom_msg.twist.covariance[21] = odomMsg->twist_covariance[3];
124 odom_msg.twist.covariance[28] = odomMsg->twist_covariance[4];
125 odom_msg.twist.covariance[35] = odomMsg->twist_covariance[5];
133 ROS_INFO(
"Requesting Odometry Covariances");
134 odom_client =
nh.
serviceClient<rosabridge_msgs::RequestOdometryCovariances>(
"rosabridge/odom_covar_srv");
135 rosabridge_msgs::RequestOdometryCovariances odomCovarSrv;
136 if (odom_client.call(odomCovarSrv))
138 odom_msg.pose.covariance[0] = odomCovarSrv.response.pose_covariance[0];
139 odom_msg.pose.covariance[1] = odomCovarSrv.response.pose_covariance[1];
140 odom_msg.pose.covariance[2] = odomCovarSrv.response.pose_covariance[2];
141 odom_msg.pose.covariance[3] = odomCovarSrv.response.pose_covariance[3];
142 odom_msg.pose.covariance[4] = odomCovarSrv.response.pose_covariance[4];
143 odom_msg.pose.covariance[5] = odomCovarSrv.response.pose_covariance[5];
144 odom_msg.pose.covariance[6] = odomCovarSrv.response.pose_covariance[6];
145 odom_msg.pose.covariance[7] = odomCovarSrv.response.pose_covariance[7];
146 odom_msg.pose.covariance[8] = odomCovarSrv.response.pose_covariance[8];
147 odom_msg.pose.covariance[9] = odomCovarSrv.response.pose_covariance[9];
148 odom_msg.pose.covariance[10] = odomCovarSrv.response.pose_covariance[10];
149 odom_msg.pose.covariance[11] = odomCovarSrv.response.pose_covariance[11];
150 odom_msg.pose.covariance[12] = odomCovarSrv.response.pose_covariance[12];
151 odom_msg.pose.covariance[13] = odomCovarSrv.response.pose_covariance[13];
152 odom_msg.pose.covariance[14] = odomCovarSrv.response.pose_covariance[14];
153 odom_msg.pose.covariance[15] = odomCovarSrv.response.pose_covariance[15];
154 odom_msg.pose.covariance[16] = odomCovarSrv.response.pose_covariance[16];
155 odom_msg.pose.covariance[17] = odomCovarSrv.response.pose_covariance[17];
156 odom_msg.pose.covariance[18] = odomCovarSrv.response.pose_covariance[18];
157 odom_msg.pose.covariance[19] = odomCovarSrv.response.pose_covariance[19];
158 odom_msg.pose.covariance[20] = odomCovarSrv.response.pose_covariance[20];
159 odom_msg.pose.covariance[21] = odomCovarSrv.response.pose_covariance[21];
160 odom_msg.pose.covariance[22] = odomCovarSrv.response.pose_covariance[22];
161 odom_msg.pose.covariance[23] = odomCovarSrv.response.pose_covariance[23];
162 odom_msg.pose.covariance[24] = odomCovarSrv.response.pose_covariance[24];
163 odom_msg.pose.covariance[25] = odomCovarSrv.response.pose_covariance[25];
164 odom_msg.pose.covariance[26] = odomCovarSrv.response.pose_covariance[26];
165 odom_msg.pose.covariance[27] = odomCovarSrv.response.pose_covariance[27];
166 odom_msg.pose.covariance[28] = odomCovarSrv.response.pose_covariance[28];
167 odom_msg.pose.covariance[29] = odomCovarSrv.response.pose_covariance[29];
168 odom_msg.pose.covariance[30] = odomCovarSrv.response.pose_covariance[30];
169 odom_msg.pose.covariance[31] = odomCovarSrv.response.pose_covariance[31];
170 odom_msg.pose.covariance[32] = odomCovarSrv.response.pose_covariance[32];
171 odom_msg.pose.covariance[33] = odomCovarSrv.response.pose_covariance[33];
172 odom_msg.pose.covariance[34] = odomCovarSrv.response.pose_covariance[34];
173 odom_msg.pose.covariance[35] = odomCovarSrv.response.pose_covariance[35];
174 odom_msg.twist.covariance[0] = odomCovarSrv.response.twist_covariance[0];
175 odom_msg.twist.covariance[1] = odomCovarSrv.response.twist_covariance[1];
176 odom_msg.twist.covariance[2] = odomCovarSrv.response.twist_covariance[2];
177 odom_msg.twist.covariance[3] = odomCovarSrv.response.twist_covariance[3];
178 odom_msg.twist.covariance[4] = odomCovarSrv.response.twist_covariance[4];
179 odom_msg.twist.covariance[5] = odomCovarSrv.response.twist_covariance[5];
180 odom_msg.twist.covariance[6] = odomCovarSrv.response.twist_covariance[6];
181 odom_msg.twist.covariance[7] = odomCovarSrv.response.twist_covariance[7];
182 odom_msg.twist.covariance[8] = odomCovarSrv.response.twist_covariance[8];
183 odom_msg.twist.covariance[9] = odomCovarSrv.response.twist_covariance[9];
184 odom_msg.twist.covariance[10] = odomCovarSrv.response.twist_covariance[10];
185 odom_msg.twist.covariance[11] = odomCovarSrv.response.twist_covariance[11];
186 odom_msg.twist.covariance[12] = odomCovarSrv.response.twist_covariance[12];
187 odom_msg.twist.covariance[13] = odomCovarSrv.response.twist_covariance[13];
188 odom_msg.twist.covariance[14] = odomCovarSrv.response.twist_covariance[14];
189 odom_msg.twist.covariance[15] = odomCovarSrv.response.twist_covariance[15];
190 odom_msg.twist.covariance[16] = odomCovarSrv.response.twist_covariance[16];
191 odom_msg.twist.covariance[17] = odomCovarSrv.response.twist_covariance[17];
192 odom_msg.twist.covariance[18] = odomCovarSrv.response.twist_covariance[18];
193 odom_msg.twist.covariance[19] = odomCovarSrv.response.twist_covariance[19];
194 odom_msg.twist.covariance[20] = odomCovarSrv.response.twist_covariance[20];
195 odom_msg.twist.covariance[21] = odomCovarSrv.response.twist_covariance[21];
196 odom_msg.twist.covariance[22] = odomCovarSrv.response.twist_covariance[22];
197 odom_msg.twist.covariance[23] = odomCovarSrv.response.twist_covariance[23];
198 odom_msg.twist.covariance[24] = odomCovarSrv.response.twist_covariance[24];
199 odom_msg.twist.covariance[25] = odomCovarSrv.response.twist_covariance[25];
200 odom_msg.twist.covariance[26] = odomCovarSrv.response.twist_covariance[26];
201 odom_msg.twist.covariance[27] = odomCovarSrv.response.twist_covariance[27];
202 odom_msg.twist.covariance[28] = odomCovarSrv.response.twist_covariance[28];
203 odom_msg.twist.covariance[29] = odomCovarSrv.response.twist_covariance[29];
204 odom_msg.twist.covariance[30] = odomCovarSrv.response.twist_covariance[30];
205 odom_msg.twist.covariance[31] = odomCovarSrv.response.twist_covariance[31];
206 odom_msg.twist.covariance[32] = odomCovarSrv.response.twist_covariance[32];
207 odom_msg.twist.covariance[33] = odomCovarSrv.response.twist_covariance[33];
208 odom_msg.twist.covariance[34] = odomCovarSrv.response.twist_covariance[34];
209 odom_msg.twist.covariance[35] = odomCovarSrv.response.twist_covariance[35];
213 ROS_WARN(
"Failed to retrieve Odometry Covariances");
220 ROS_INFO(
"Subscribing to topic rosabridge/odom");
223 ROS_INFO(
"Relaying between topics...");
231 int main(
int argc,
char **argv)
234 ros::init(argc, argv,
"odom_proxy_node");
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
tf::TransformBroadcaster odom_broadcaster
void publish(const boost::shared_ptr< M > &message) const
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
nav_msgs::Odometry odom_msg
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ROSCPP_DECL void spin(Spinner &spinner)
void odom_callback(const rosabridge_msgs::Odometry::ConstPtr &odomMsg)
int main(int argc, char **argv)
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
#define ROS_INFO_STREAM(args)
geometry_msgs::TransformStamped trans_msg
void mySigintHandler(int sig)
ROSCPP_DECL void shutdown()