bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
chrono_diff_drive::CHRONO_DiffDriveRobot::RobotSensorManager Class Reference

#include <diff_drive_robot.h>

Public Member Functions

 RobotSensorManager ()
template<typename Archive>
void read (const Archive &arch, std::shared_ptr< chrono::ChBody > body)
template<>
void read (const json &j, std::shared_ptr< chrono::ChBody > body)
uint_t n_sensors () const noexcept
void add (std::shared_ptr< sensors::SensorBase > sensor)
 Add a new sensor to manage.
std::shared_ptr< sensors::SensorBase > get (const std::string &name) const
std::shared_ptr< sensors::UltrasonicSensor > front_sonar () const noexcept
std::shared_ptr< sensors::UltrasonicSensor > rear_sonar () const noexcept
std::shared_ptr< sensors::InfraredSensor > line_sensor () const noexcept
std::shared_ptr< sensors::IMUSensor > imu () const noexcept

Detailed Description

Class to manage the sensors attached on this

Constructor & Destructor Documentation

◆ RobotSensorManager()

Member Function Documentation

◆ add()

void bitsim::rb::bitsim_chrono::CHRONO_DiffDriveRobot::RobotSensorManager::add ( std::shared_ptr< sensors::SensorBase > sensor)
inline

Add a new sensor to manage.

Parameters
sensor

◆ front_sonar()

std::shared_ptr< sensors::UltrasonicSensor > bitsim::rb::bitsim_chrono::CHRONO_DiffDriveRobot::RobotSensorManager::front_sonar ( ) const
inlinenoexcept
Returns
The front-sonar of the robot file, or null if it has none

◆ get()

std::shared_ptr< sensors::SensorBase > bitsim::rb::bitsim_chrono::CHRONO_DiffDriveRobot::RobotSensorManager::get ( const std::string & name) const
Returns
The sensor with the given name, or null if there is none

◆ imu()

std::shared_ptr< sensors::IMUSensor > bitsim::rb::bitsim_chrono::CHRONO_DiffDriveRobot::RobotSensorManager::imu ( ) const
inlinenoexcept
Returns
The imu of the robot file, or null if it has none

◆ line_sensor()

std::shared_ptr< sensors::InfraredSensor > bitsim::rb::bitsim_chrono::CHRONO_DiffDriveRobot::RobotSensorManager::line_sensor ( ) const
inlinenoexcept
Returns
The line-sensor of the robot file, or null if it has none

◆ n_sensors()

Returns
The number of registered senosrs

◆ read() [1/2]

template<typename Archive>
void bitsim::rb::bitsim_chrono::CHRONO_DiffDriveRobot::RobotSensorManager::read ( const Archive & arch,
std::shared_ptr< chrono::ChBody > body )

Load the sensors of the robot from the archive. It reads, if they are there and enabled:

  • front-sonar, an ultrasonic range sensor that looks ahead
  • line-sensor, an array of infrared elements that look at the floor
  • imu, an accelerometer and a gyroscope

Each has a backend: SIMULATION, or MQTT for a real sensor on a board. An MQTT backend reads its broker and topic from the file too; connect it before reading the sensor.

Template Parameters
ArchiveThe type of the archive, for example nlohmann::json
Parameters
archThe sensors section of the robot file
bodyThe body the sensors are attached to

◆ read() [2/2]

template<>
void bitsim::rb::bitsim_chrono::CHRONO_DiffDriveRobot::RobotSensorManager::read ( const json & j,
std::shared_ptr< chrono::ChBody > body )

◆ rear_sonar()

std::shared_ptr< sensors::UltrasonicSensor > bitsim::rb::bitsim_chrono::CHRONO_DiffDriveRobot::RobotSensorManager::rear_sonar ( ) const
inlinenoexcept
Returns
The rear-sonar of the robot file, or null if it has none

The documentation for this class was generated from the following files: