.. _program_listing_file_include_turtlebot3_node_turtlebot3.hpp: Program Listing for File turtlebot3.hpp ======================================= |exhale_lsh| :ref:`Return to documentation for file ` (``include/turtlebot3_node/turtlebot3.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp // Copyright 2019 ROBOTIS CO., LTD. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Author: Darby Lim #ifndef TURTLEBOT3_NODE__TURTLEBOT3_HPP_ #define TURTLEBOT3_NODE__TURTLEBOT3_HPP_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "turtlebot3_node/control_table.hpp" #include "turtlebot3_node/devices/devices.hpp" #include "turtlebot3_node/devices/motor_power.hpp" #include "turtlebot3_node/devices/reset.hpp" #include "turtlebot3_node/devices/sound.hpp" #include "turtlebot3_node/dynamixel_sdk_wrapper.hpp" #include "turtlebot3_node/odometry.hpp" #include "turtlebot3_node/sensors/battery_state.hpp" #include "turtlebot3_node/sensors/imu.hpp" #include "turtlebot3_node/sensors/joint_state.hpp" #include "turtlebot3_node/sensors/sensor_state.hpp" #include "turtlebot3_node/sensors/sensors.hpp" #include "turtlebot3_node/twist_subscriber.hpp" namespace robotis { namespace turtlebot3 { extern const ControlTable extern_control_table; class TurtleBot3 : public rclcpp::Node { public: typedef struct { float separation; float radius; } Wheels; typedef struct { float profile_acceleration_constant; float profile_acceleration; } Motors; explicit TurtleBot3(const std::string & usb_port); virtual ~TurtleBot3() {} Wheels * get_wheels(); Motors * get_motors(); private: void init_dynamixel_sdk_wrapper(const std::string & usb_port); void check_device_status(); void add_sensors(); void add_devices(); void add_motors(); void add_wheels(); void run(); void publish_timer(const std::chrono::milliseconds timeout); void heartbeat_timer(const std::chrono::milliseconds timeout); void cmd_vel_callback(); void parameter_event_callback(); Wheels wheels_; Motors motors_; std::shared_ptr dxl_sdk_wrapper_; std::list sensors_; std::map devices_; std::unique_ptr odom_; rclcpp::Node::SharedPtr node_handle_; rclcpp::TimerBase::SharedPtr publish_timer_; rclcpp::TimerBase::SharedPtr heartbeat_timer_; std::unique_ptr cmd_vel_sub_; rclcpp::AsyncParametersClient::SharedPtr priv_parameters_client_; rclcpp::Subscription::SharedPtr parameter_event_sub_; }; } // namespace turtlebot3 } // namespace robotis #endif // TURTLEBOT3_NODE__TURTLEBOT3_HPP_