Skip to content

Commit

Permalink
Renaming imu_2d
Browse files Browse the repository at this point in the history
  • Loading branch information
ayrton04 committed Aug 14, 2019
1 parent 246a1a6 commit 9731c49
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 34 deletions.
2 changes: 1 addition & 1 deletion fuse_models/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ include_directories(
add_library(
${PROJECT_NAME}
src/acceleration_2d.cpp
src/imu_2d/model.cpp
src/imu_2d.cpp
src/pose_2d/model.cpp
src/odometry_2d/model.cpp
src/odometry_2d/publisher.cpp
Expand Down
2 changes: 1 addition & 1 deletion fuse_models/fuse_plugins.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
another node
</description>
</class>
<class type="fuse_models::imu_2d::Model" base_class_type="fuse_core::SensorModel">
<class type="fuse_models::Imu2D" base_class_type="fuse_core::SensorModel">
<description>
An adapter-type sensor that produces orientation (relative or absolute), angular velocity, and linear
acceleration constraints from IMU sensor data published by another node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FUSE_MODELS_IMU_2D_MODEL_H
#define FUSE_MODELS_IMU_2D_MODEL_H
#ifndef FUSE_MODELS_IMU_2D_H
#define FUSE_MODELS_IMU_2D_H

#include <fuse_models/parameters/imu_2d_model_params.h>
#include <fuse_models/parameters/imu_2d_params.h>

#include <fuse_core/async_sensor_model.h>
#include <fuse_core/uuid.h>
Expand All @@ -51,9 +51,6 @@
namespace fuse_models
{

namespace imu_2d
{

/**
* @brief An adapter-type sensor that produces orientation (relative or absolute), angular velocity, and linear
* acceleration constraints from IMU sensor data published by another node
Expand Down Expand Up @@ -85,21 +82,21 @@ namespace imu_2d
* Subscribes:
* - \p topic (sensor_msgs::Imu) IMU data at a given timestep
*/
class Model : public fuse_core::AsyncSensorModel
class Imu2D : public fuse_core::AsyncSensorModel
{
public:
SMART_PTR_DEFINITIONS(Model);
using ParameterType = parameters::Imu2DModelParams;
SMART_PTR_DEFINITIONS(Imu2D);
using ParameterType = parameters::Imu2DParams;

/**
* @brief Default constructor
*/
Model();
Imu2D();

/**
* @brief Destructor
*/
virtual ~Model() = default;
virtual ~Imu2D() = default;

/**
* @brief Callback for pose messages
Expand Down Expand Up @@ -140,8 +137,6 @@ class Model : public fuse_core::AsyncSensorModel
ros::Subscriber subscriber_;
};

} // namespace imu_2d

} // namespace fuse_models

#endif // FUSE_MODELS_IMU_2D_MODEL_H
#endif // FUSE_MODELS_IMU_2D_H
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FUSE_MODELS_PARAMETERS_IMU_2D_MODEL_PARAMS_H
#define FUSE_MODELS_PARAMETERS_IMU_2D_MODEL_PARAMS_H
#ifndef FUSE_MODELS_PARAMETERS_IMU_2D_PARAMS_H
#define FUSE_MODELS_PARAMETERS_IMU_2D_PARAMS_H

#include <fuse_models/parameters/parameter_base.h>

Expand All @@ -52,9 +52,9 @@ namespace parameters
{

/**
* @brief Defines the set of parameters required by the imu_2d::Model class
* @brief Defines the set of parameters required by the Imu2D class
*/
struct Imu2DModelParams : public ParameterBase
struct Imu2DParams : public ParameterBase
{
public:
/**
Expand Down Expand Up @@ -109,4 +109,4 @@ struct Imu2DModelParams : public ParameterBase

} // namespace fuse_models

#endif // FUSE_MODELS_PARAMETERS_IMU_2D_MODEL_PARAMS_H
#endif // FUSE_MODELS_PARAMETERS_IMU_2D_PARAMS_H
21 changes: 8 additions & 13 deletions fuse_models/src/imu_2d/model.cpp → fuse_models/src/imu_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <fuse_models/common/sensor_proc.h>
#include <fuse_models/imu_2d/model.h>
#include <fuse_models/imu_2d.h>

#include <fuse_core/transaction.h>
#include <fuse_core/uuid.h>
Expand All @@ -48,22 +48,19 @@


// Register this sensor model with ROS as a plugin.
PLUGINLIB_EXPORT_CLASS(fuse_models::imu_2d::Model, fuse_core::SensorModel)
PLUGINLIB_EXPORT_CLASS(fuse_models::Imu2D, fuse_core::SensorModel)

namespace fuse_models
{

namespace imu_2d
{

Model::Model() :
Imu2D::Imu2D() :
fuse_core::AsyncSensorModel(1),
device_id_(fuse_core::uuid::NIL),
tf_listener_(tf_buffer_)
{
}

void Model::onInit()
void Imu2D::onInit()
{
// Read settings from the parameter sever
device_id_ = fuse_variables::loadDeviceId(private_node_handle_);
Expand All @@ -79,23 +76,23 @@ void Model::onInit()
}
}

void Model::onStart()
void Imu2D::onStart()
{
if (!params_.orientation_indices.empty() ||
!params_.linear_acceleration_indices.empty() ||
!params_.angular_velocity_indices.empty())
{
previous_pose_.reset();
subscriber_ = node_handle_.subscribe(ros::names::resolve(params_.topic), params_.queue_size, &Model::process, this);
subscriber_ = node_handle_.subscribe(ros::names::resolve(params_.topic), params_.queue_size, &Imu2D::process, this);
}
}

void Model::onStop()
void Imu2D::onStop()
{
subscriber_.shutdown();
}

void Model::process(const sensor_msgs::Imu::ConstPtr& msg)
void Imu2D::process(const sensor_msgs::Imu::ConstPtr& msg)
{
// Create a transaction object
auto transaction = fuse_core::Transaction::make_shared();
Expand Down Expand Up @@ -206,6 +203,4 @@ void Model::process(const sensor_msgs::Imu::ConstPtr& msg)
sendTransaction(transaction);
}

} // namespace imu_2d

} // namespace fuse_models

0 comments on commit 9731c49

Please sign in to comment.