1#ifndef CHRONO_DIFF_DRIVE_ROBOT_H
2#define CHRONO_DIFF_DRIVE_ROBOT_H
4#include "bitrl/bitrl_config.h"
13#include <chrono/physics/ChSystemSMC.h>
14#include <chrono/physics/ChLinkMotorRotationSpeed.h>
23namespace rb::bitrl_chrono
40class CHRONO_DiffDriveRobotBase
44 typedef CHRONO_RobotPose pose_type;
50 std::shared_ptr<chrono::ChLinkMotorRotationSpeed> motor;
51 std::shared_ptr<chrono::ChFunctionConst> speed;
72 void load_from_json(
const std::string& filename);
78 void step(real_t time_step);
85 void set_motor_speed(
const std::string& motor_name, real_t speed);
91 void set_motor_speed(real_t speed);
97 const std::string& get_name() const noexcept{
return name_;}
103 uint_t n_wheels()const noexcept{
return 3;}
109 uint_t n_motors()const noexcept{
return 2;}
115 void set_sensors(sensors::SensorManager& sensor_manager){sensor_manager_ptr_ = &sensor_manager;}
120 chrono::ChSystemSMC& CHRONO_sys() noexcept{
return sys_;}
123 std::shared_ptr<chrono::ChBody> CHRONO_chassis()noexcept{
return chassis_;}
128 std::shared_ptr<pose_type> pose()noexcept{
return pose_;}
140 chrono::ChSystemSMC sys_;
145 std::shared_ptr<chrono::ChBody> chassis_;
150 std::shared_ptr<pose_type> pose_;
155 sensors::SensorManager* sensor_manager_ptr_;
162 std::pair<MotorHandle, MotorHandle> motors_;
171inline void CHRONO_DiffDriveRobotBase::set_motor_speed(real_t speed)
173 set_motor_speed(
"left_motor", speed);
174 set_motor_speed(
"right_motor", speed);
Definition bitrl_consts.h:14
std::size_t uint_t
uint_t
Definition bitrl_types.h:43