bitrl & cuberl Documentation
Simulation engine for reinforcement learning agents
Loading...
Searching...
No Matches
diff_drive_robot.h
Go to the documentation of this file.
1
2// =============================================================================
3// Authors: Jason Zhou
4// =============================================================================
5//
6// Turtlebot Robot Class
7// This is a modified version of the famous turtlebot 2e
8// The geometries use the following resources as references:
9// https://groups.google.com/g/sydney_ros/c/z05uQTCuDTQ
10// https://grabcad.com/library/interbotix-turtlebot-2i-1
11// https://www.turtlebot.com/turtlebot2/
12//
13// =============================================================================
14
15#ifndef DIFF_DRIVE_ROBOT_H
16#define DIFF_DRIVE_ROBOT_H
17
18#include "bitrl/bitrl_config.h"
19
20#ifdef BITRL_CHRONO
21
22
23#include "bitrl/bitrl_types.h"
29
30#include "chrono/physics/ChSystem.h"
31#include "chrono/physics/ChLinkMotorRotationSpeed.h"
32#include <vector>
33
34
35namespace bitrl
36{
37namespace rb::bitrl_chrono{
38
39
49class CHRONO_DiffDriveRobot final {
50public:
51 CHRONO_DiffDriveRobot(chrono::ChSystem& system,
52 const chrono::ChVector3d& robot_pos,
53 const chrono::ChQuaternion<>& robot_rot,
54 std::shared_ptr<chrono::ChContactMaterial> wheel_mat = {});
55
56
58 ~CHRONO_DiffDriveRobot()=default;
59
62 void init();
63
65 void set_motor_speed(real_t rad_speed, uint_t id);
66
68 chrono::ChVector3d get_active_wheel_speed(uint_t id) const;
69
71 chrono::ChVector3d get_active_wheel_angular_velocity(uint_t id)const;
72
74 const CHRONO_RobotPose& get_pose() const{return pose_;}
75
76private:
77
79 void build_motors_();
80
82 chrono::ChSystem* system_;
83
85 std::shared_ptr<CHRONO_DiffDriveRobot_Chassis> chassis_;
86 std::vector<std::shared_ptr<CHRONO_DiffDriveRobot_ActiveWheel>> drive_wheels_;
87 std::vector<std::shared_ptr<CHRONO_DiffDriveRobot_PassiveWheel>> passive_wheels_;
88
89 std::vector<std::shared_ptr<CHRONO_DiffDriveRobot_Rod_Short>> m_1st_level_rods_;
90 std::vector<std::shared_ptr<CHRONO_DiffDriveRobot_Rod_Short>> m_2nd_level_rods_;
91 std::vector<std::shared_ptr<CHRONO_DiffDriveRobot_Rod_Long>> m_3rd_level_rods_;
92 std::shared_ptr<CHRONO_DiffDriveRobot_BottomPlate> bottom_plate_;
93 std::shared_ptr<CHRONO_DiffDriveRobot_MiddlePlate> middle_plate_;
94 std::shared_ptr<CHRONO_DiffDriveRobot_TopPlate> top_plate_;
95
96 chrono::ChQuaternion<> robot_rot_;
97 chrono::ChVector3d robot_pos_;
98
99 std::vector<std::shared_ptr<chrono::ChLinkMotorRotationSpeed>> motors_;
100 std::vector<std::shared_ptr<chrono::ChFunctionConst>> motors_func_;
101
102 // model parts material
103 std::shared_ptr<chrono::ChContactMaterial> chassis_material_;
104 std::shared_ptr<chrono::ChContactMaterial> wheel_material_;
105
107 CHRONO_RobotPose pose_;
108
109 bool dc_motor_control_ = false;
110};
111
112
113} // namespace chrono
114}
115#endif
116#endif
117
Definition bitrl_consts.h:14