25 bool init_result =
init();
40 std::string robot_model =
nh_.
param<std::string>(
"tb3_model",
"");
42 if (!robot_model.compare(
"burger"))
48 else if (!robot_model.compare(
"waffle") || !robot_model.compare(
"waffle_pi"))
58 nh_.
param(
"odom_frame",
odom_.header.frame_id, std::string(
"odom"));
59 nh_.
param(
"base_frame",
odom_.child_frame_id, std::string(
"base_footprint"));
72 double pcov[36] = { 0.1, 0, 0, 0, 0, 0,
78 memcpy(&(
odom_.pose.covariance),pcov,
sizeof(
double)*36);
79 memcpy(&(
odom_.twist.covariance),pcov,
sizeof(
double)*36);
126 double wheel_l, wheel_r;
127 double delta_s, delta_theta;
130 wheel_l = wheel_r = 0.0;
131 delta_s = delta_theta = 0.0;
161 odom_pose_[0] += delta_s *
cos(odom_pose_[2] + (delta_theta / 2.0));
162 odom_pose_[1] += delta_s *
sin(odom_pose_[2] + (delta_theta / 2.0));
163 odom_pose_[2] += delta_theta;
170 odom_.pose.pose.position.x = odom_pose_[0];
171 odom_.pose.pose.position.y = odom_pose_[1];
172 odom_.pose.pose.position.z = 0;
198 odom_tf.header =
odom_.header;
199 odom_tf.child_frame_id =
odom_.child_frame_id;
200 odom_tf.transform.translation.x =
odom_.pose.pose.position.x;
201 odom_tf.transform.translation.y =
odom_.pose.pose.position.y;
202 odom_tf.transform.translation.z =
odom_.pose.pose.position.z;
203 odom_tf.transform.rotation =
odom_.pose.pose.orientation;
213 prev_update_time_ = time_now;
224 odom_.header.stamp = time_now;
233 geometry_msgs::TransformStamped odom_tf;
243 int main(
int argc,
char* argv[])
245 ros::init(argc, argv,
"turtlebot3_fake_node");
std::string joint_states_name_[2]
ros::Publisher joint_states_pub_
ros::Subscriber cmd_vel_sub_
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())
sensor_msgs::JointState joint_states_
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ros::Time last_cmd_vel_time_
double wheel_speed_cmd_[2]
void commandVelocityCallback(const geometry_msgs::TwistConstPtr cmd_vel_msg)
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
int main(int argc, char *argv[])
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
ros::Time prev_update_time_
bool updateOdometry(ros::Duration diff_time)
TFSIMD_FORCE_INLINE const tfScalar & w() const
static geometry_msgs::Quaternion createQuaternionMsgFromYaw(double yaw)
tf::TransformBroadcaster tf_broadcaster_
double goal_angular_velocity_
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
void updateTF(geometry_msgs::TransformStamped &odom_tf)
ROSCPP_DECL void spinOnce()
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)
double goal_linear_velocity_