25 ROS_INFO(
"TurtleBot3 Simulation Node Init");
42 std::string robot_model =
nh_.
param<std::string>(
"tb3_model",
"");
43 std::string cmd_vel_topic_name =
nh_.
param<std::string>(
"cmd_vel_topic_name",
"");
45 if (!robot_model.compare(
"burger"))
52 else if (!robot_model.compare(
"waffle") || !robot_model.compare(
"waffle_pi"))
60 ROS_INFO(
"robot_model : %s", robot_model.c_str());
85 uint16_t scan_angle[3] = {0, 30, 330};
87 for (
int num = 0; num < 3; num++)
89 if (std::isinf(msg->ranges.at(scan_angle[num])))
102 geometry_msgs::Twist cmd_vel;
104 cmd_vel.linear.x = linear;
105 cmd_vel.angular.z = angular;
115 static uint8_t turtlebot3_state_num = 0;
116 double wheel_radius = 0.033;
117 double turtlebot3_rotation = 0.0;
121 switch(turtlebot3_state_num)
193 int main(
int argc,
char* argv[])
195 ros::init(argc, argv,
"turtlebot3_drive");
void laserScanMsgCallBack(const sensor_msgs::LaserScan::ConstPtr &msg)
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())
double right_joint_encoder_
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
void jointStateMsgCallBack(const sensor_msgs::JointState::ConstPtr &msg)
double front_distance_limit_
double direction_vector_[3]
#define TB3_DRIVE_FORWARD
int main(int argc, char *argv[])
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
ros::Publisher cmd_vel_pub_
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
double side_distance_limit_
#define GET_TB3_DIRECTION
ros::Subscriber joint_state_sub_
ROSCPP_DECL void shutdown()
void updatecommandVelocity(double linear, double angular)
double priv_right_joint_encoder_
ros::Subscriber laser_scan_sub_
ROSCPP_DECL void spinOnce()