Skip to content

Commit eb50ff8

Browse files
authored
Merge pull request #238 from ROBOTIS-GIT/feature-machine-learning-jazzy
Update simulation for machine learning jazzy version
2 parents 8b28e28 + 65de107 commit eb50ff8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1534
-343
lines changed

.github/workflows/ros-ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
ros_distribution:
20-
- humble
20+
# - humble
2121
- jazzy
2222
- rolling
2323
include:
2424
# ROS 2 Humble Hawksbill
25-
- docker_image: ubuntu:jammy
26-
ros_distribution: humble
27-
ros_version: 2
25+
# - docker_image: ubuntu:jammy
26+
# ros_distribution: humble
27+
# ros_version: 2
2828
# ROS 2 Jazzy Jalisco
2929
- docker_image: ubuntu:noble
3030
ros_distribution: jazzy

turtlebot3_fake_node/CHANGELOG.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
Changelog for package turtlebot3_fake
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44

5+
2.3.5 (2025-06-04)
6+
------------------
7+
* None
8+
59
2.3.3 (2025-05-29)
610
------------------
711
* Deprecate ament_include_dependency usage in CMakeLists.txt, related PR(https://github.com/ROBOTIS-GIT/turtlebot3_simulations/pull/234)

turtlebot3_fake_node/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
33
<package format="3">
44
<name>turtlebot3_fake_node</name>
5-
<version>2.3.3</version>
5+
<version>2.3.5</version>
66
<description>
77
Package for TurtleBot3 fake node. With this package, simple tests can be done without a robot.
88
You can do simple tests using this package on rviz without real robots.

turtlebot3_gazebo/CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
Changelog for package turtlebot3_gazebo
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
44

5+
2.3.5 (2025-06-04)
6+
------------------
7+
* Added turtlebot3_machine_learning world and plugin
8+
* Contributors: ChanHyeong Lee
9+
510
2.3.3 (2025-05-29)
611
------------------
712
* Deprecate ament_include_dependency usage in CMakeLists.txt, related PR(https://github.com/ROBOTIS-GIT/turtlebot3_simulations/pull/234)

turtlebot3_gazebo/CMakeLists.txt

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
################################################################################
22
# Set minimum required version of cmake, project name and compile options
33
################################################################################
4-
cmake_minimum_required(VERSION 3.5)
4+
cmake_minimum_required(VERSION 3.8)
55
project(turtlebot3_gazebo)
66

77
if(NOT CMAKE_CXX_STANDARD)
@@ -26,17 +26,26 @@ find_package(nav_msgs REQUIRED)
2626
find_package(rclcpp REQUIRED)
2727
find_package(sensor_msgs REQUIRED)
2828
find_package(tf2 REQUIRED)
29+
find_package(gz_math_vendor REQUIRED)
30+
find_package(gz-math REQUIRED)
31+
find_package(gz_sim_vendor REQUIRED)
32+
find_package(gz-sim REQUIRED)
33+
find_package(gz_plugin_vendor REQUIRED)
34+
find_package(gz-plugin REQUIRED)
2935

3036
################################################################################
3137
# Build
3238
################################################################################
3339
link_directories(
3440
${GAZEBO_LIBRARY_DIRS}
41+
${GZ_SIM_LIBRARY_DIRS}
3542
)
3643

3744
include_directories(
3845
include
3946
${GAZEBO_INCLUDE_DIRS}
47+
${gz_sim_vendor_INCLUDE_DIRS}
48+
${GZ_SIM_INCLUDE_DIRS}
4049
)
4150

4251
set(EXEC_NAME "turtlebot3_drive")
@@ -50,25 +59,29 @@ target_link_libraries(${EXEC_NAME}
5059
tf2::tf2
5160
)
5261

53-
# add_library(traffic_light_plugin SHARED src/traffic_light_plugin.cpp)
54-
# target_link_libraries(traffic_light_plugin ${GAZEBO_LIBRARIES})
55-
56-
# add_library(traffic_bar_plugin SHARED src/traffic_bar_plugin.cpp)
57-
# target_link_libraries(traffic_bar_plugin ${GAZEBO_LIBRARIES})
58-
59-
# add_library(obstacle1 SHARED src/obstacle1.cpp)
60-
# target_link_libraries(obstacle1 ${GAZEBO_LIBRARIES})
61-
62-
# add_library(obstacle2 SHARED src/obstacle2.cpp)
63-
# target_link_libraries(obstacle2 ${GAZEBO_LIBRARIES})
62+
set(OBSTACLE_LIBS
63+
obstacles
64+
obstacle1
65+
obstacle2
66+
)
6467

65-
# add_library(obstacles SHARED src/obstacles.cpp)
66-
# target_link_libraries(obstacles ${GAZEBO_LIBRARIES})
68+
foreach(lib ${OBSTACLE_LIBS})
69+
add_library(${lib} SHARED src/${lib}.cpp)
70+
target_link_libraries(${lib}
71+
PUBLIC
72+
gz-sim::gz-sim
73+
gz-math::gz-math
74+
)
75+
endforeach()
6776

6877
################################################################################
6978
# Install
7079
################################################################################
71-
install(TARGETS ${EXEC_NAME}
80+
install(TARGETS
81+
${EXEC_NAME}
82+
obstacles
83+
obstacle1
84+
obstacle2
7285
DESTINATION lib/${PROJECT_NAME}
7386
)
7487

turtlebot3_gazebo/include/turtlebot3_gazebo/obstacle1.hpp

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,51 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414
//
15-
// Author: Ryan Shim
15+
// Author: Ryan Shim, ChanHyeong Lee
1616

1717
#ifndef TURTLEBOT3_GAZEBO__OBSTACLE1_HPP_
1818
#define TURTLEBOT3_GAZEBO__OBSTACLE1_HPP_
1919

20-
#include <ignition/math.hh>
21-
#include <gazebo/common/common.hh>
22-
#include <gazebo/gazebo.hh>
23-
#include <gazebo/physics/physics.hh>
20+
#include <chrono>
21+
#include <memory>
22+
#include <vector>
2423

25-
namespace gazebo
24+
#include <gz/sim/System.hh>
25+
#include <gz/sim/Model.hh>
26+
#include <gz/math/Vector3.hh>
27+
28+
namespace turtlebot3_gazebo
2629
{
27-
class Obstacle1 : public ModelPlugin
30+
31+
class Obstacle1Plugin
32+
: public gz::sim::System,
33+
public gz::sim::ISystemConfigure,
34+
public gz::sim::ISystemPreUpdate
2835
{
2936
public:
30-
void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/) override;
37+
Obstacle1Plugin() = default;
38+
~Obstacle1Plugin() override = default;
39+
40+
void Configure(
41+
const gz::sim::Entity & entity,
42+
const std::shared_ptr<const sdf::Element> & sdf,
43+
gz::sim::EntityComponentManager & ecm,
44+
gz::sim::EventManager & eventMgr) override;
45+
46+
void PreUpdate(
47+
const gz::sim::UpdateInfo & info,
48+
gz::sim::EntityComponentManager & ecm) override;
3149

3250
private:
33-
physics::ModelPtr model;
34-
event::ConnectionPtr updateConnection;
51+
gz::sim::Model model;
52+
std::chrono::steady_clock::time_point startTime;
53+
54+
std::vector<gz::math::Vector3d> waypoints;
55+
std::vector<double> segmentDistances;
56+
double totalDistance = 0.0;
57+
double speed = 0.1; // meters per second
3558
};
36-
GZ_REGISTER_MODEL_PLUGIN(Obstacle1);
37-
} // namespace gazebo
59+
60+
} // namespace turtlebot3_gazebo
61+
3862
#endif // TURTLEBOT3_GAZEBO__OBSTACLE1_HPP_

turtlebot3_gazebo/include/turtlebot3_gazebo/obstacle2.hpp

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,51 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414
//
15-
// Author: Ryan Shim
15+
// Author: Ryan Shim, ChanHyeong Lee
1616

1717
#ifndef TURTLEBOT3_GAZEBO__OBSTACLE2_HPP_
1818
#define TURTLEBOT3_GAZEBO__OBSTACLE2_HPP_
1919

20-
#include <ignition/math.hh>
21-
#include <gazebo/common/common.hh>
22-
#include <gazebo/gazebo.hh>
23-
#include <gazebo/physics/physics.hh>
20+
#include <chrono>
21+
#include <memory>
22+
#include <vector>
2423

25-
namespace gazebo
24+
#include <gz/sim/System.hh>
25+
#include <gz/sim/Model.hh>
26+
#include <gz/math/Vector3.hh>
27+
28+
namespace turtlebot3_gazebo
2629
{
27-
class Obstacle2 : public ModelPlugin
30+
31+
class Obstacle2Plugin
32+
: public gz::sim::System,
33+
public gz::sim::ISystemConfigure,
34+
public gz::sim::ISystemPreUpdate
2835
{
2936
public:
30-
Obstacle2() = default;
31-
void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/) override;
37+
Obstacle2Plugin() = default;
38+
~Obstacle2Plugin() override = default;
39+
40+
void Configure(
41+
const gz::sim::Entity & entity,
42+
const std::shared_ptr<const sdf::Element> & sdf,
43+
gz::sim::EntityComponentManager & ecm,
44+
gz::sim::EventManager & eventMgr) override;
45+
46+
void PreUpdate(
47+
const gz::sim::UpdateInfo & info,
48+
gz::sim::EntityComponentManager & ecm) override;
3249

3350
private:
34-
physics::ModelPtr model;
35-
event::ConnectionPtr updateConnection;
51+
gz::sim::Model model;
52+
std::chrono::steady_clock::time_point startTime;
53+
54+
std::vector<gz::math::Vector3d> waypoints;
55+
std::vector<double> segmentDistances;
56+
double totalDistance = 0.0;
57+
double speed = 0.1; // meters per second
3658
};
37-
GZ_REGISTER_MODEL_PLUGIN(Obstacle2);
38-
} // namespace gazebo
59+
60+
} // namespace turtlebot3_gazebo
61+
3962
#endif // TURTLEBOT3_GAZEBO__OBSTACLE2_HPP_

turtlebot3_gazebo/include/turtlebot3_gazebo/obstacles.hpp

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,44 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414
//
15-
// Author: Ryan Shim
15+
// Author: Ryan Shim, ChanHyeong Lee
1616

1717
#ifndef TURTLEBOT3_GAZEBO__OBSTACLES_HPP_
1818
#define TURTLEBOT3_GAZEBO__OBSTACLES_HPP_
1919

20-
#include <ignition/math.hh>
21-
#include <gazebo/common/common.hh>
22-
#include <gazebo/gazebo.hh>
23-
#include <gazebo/physics/physics.hh>
20+
#include <chrono>
21+
#include <memory>
2422

25-
#define PI 3.141592
23+
#include <gz/sim/components/Pose.hh>
24+
#include <gz/sim/EntityComponentManager.hh>
25+
#include <gz/sim/EventManager.hh>
26+
#include <gz/sim/Model.hh>
27+
#include <gz/sim/System.hh>
2628

27-
namespace gazebo
29+
namespace turtlebot3_gazebo
2830
{
29-
class Obstacles : public ModelPlugin
31+
32+
class ObstaclesPlugin
33+
: public gz::sim::System,
34+
public gz::sim::ISystemConfigure,
35+
public gz::sim::ISystemPreUpdate
3036
{
3137
public:
32-
Obstacles() = default;
33-
void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/) override;
38+
void Configure(
39+
const gz::sim::Entity & entity,
40+
const std::shared_ptr<const sdf::Element> & sdf,
41+
gz::sim::EntityComponentManager & ecm,
42+
gz::sim::EventManager & eventMgr) override;
43+
44+
void PreUpdate(
45+
const gz::sim::UpdateInfo & info,
46+
gz::sim::EntityComponentManager & ecm) override;
3447

3548
private:
36-
physics::ModelPtr model;
37-
event::ConnectionPtr updateConnection;
49+
gz::sim::Model model{gz::sim::kNullEntity};
50+
std::chrono::steady_clock::time_point startTime;
3851
};
39-
GZ_REGISTER_MODEL_PLUGIN(Obstacles);
40-
} // namespace gazebo
52+
53+
} // namespace turtlebot3_gazebo
54+
4155
#endif // TURTLEBOT3_GAZEBO__OBSTACLES_HPP_

0 commit comments

Comments
 (0)