Skip to content

Commit

Permalink
[aerial_robot_model] change desire coordinate message to quaternion i…
Browse files Browse the repository at this point in the history
…n modeling
  • Loading branch information
sugikazu75 committed Apr 13, 2024
1 parent a35443d commit 019813c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@

#include <aerial_robot_model/model/aerial_robot_model.h>
#include <aerial_robot_model/AddExtraModule.h>
#include <geometry_msgs/Quaternion.h>
#include <pluginlib/class_loader.h>
#include <spinal/DesireCoord.h>
#include <tf/tf.h>
#include <tf2_ros/transform_broadcaster.h>
#include <tf2_ros/static_transform_broadcaster.h>
Expand Down Expand Up @@ -74,6 +74,6 @@ namespace aerial_robot_model {
//private functions
void jointStateCallback(const sensor_msgs::JointStateConstPtr& state);
bool addExtraModuleCallback(aerial_robot_model::AddExtraModule::Request& req, aerial_robot_model::AddExtraModule::Response& res);
void desireCoordinateCallback(const spinal::DesireCoordConstPtr& msg);
void desireCoordinateCallback(const geometry_msgs::QuaternionConstPtr& msg);
};
} //namespace aerial_robot_model
5 changes: 3 additions & 2 deletions aerial_robot_model/src/model/base_model/robot_model_ros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ namespace aerial_robot_model {
return false;
}

void RobotModelRos::desireCoordinateCallback(const spinal::DesireCoordConstPtr& msg)
void RobotModelRos::desireCoordinateCallback(const geometry_msgs::QuaternionConstPtr& msg)
{
robot_model_->setCogDesireOrientation(msg->roll, msg->pitch, msg->yaw);
KDL::Rotation rot = KDL::Rotation::Quaternion(msg->x, msg->y, msg->z, msg->w);
robot_model_->setCogDesireOrientation(rot);
}
} //namespace aerial_robot_model
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ namespace aerial_robot_model {
nhp_.param("feasible_control_torque_diff_thre", feasible_control_torque_diff_thre_, 0.001);
}

void NumericalJacobian::desireCoordinateCallback(const spinal::DesireCoordConstPtr& msg)
void NumericalJacobian::desireCoordinateCallback(const geometry_msgs::QuaternionConstPtr& msg)
{
getRobotModel().setCogDesireOrientation(msg->roll, msg->pitch, msg->yaw);
KDL::Rotation rot = KDL::Rotation::Quaternion(msg->x, msg->y, msg->z, msg->w);
getRobotModel().setCogDesireOrientation(rot);
}

void NumericalJacobian::jointStateCallback(const sensor_msgs::JointStateConstPtr& state)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#pragma once

#include <aerial_robot_model/model/transformable_aerial_robot_model.h>
#include <spinal/DesireCoord.h>
#include <geometry_msgs/Quaternion.h>

namespace aerial_robot_model {

Expand Down Expand Up @@ -82,7 +82,7 @@ namespace aerial_robot_model {
aerial_robot_model::transformable::RobotModel& getRobotModel() const { return *robot_model_; }

void jointStateCallback(const sensor_msgs::JointStateConstPtr& state);
void desireCoordinateCallback(const spinal::DesireCoordConstPtr& msg);
void desireCoordinateCallback(const geometry_msgs::QuaternionConstPtr& msg);

// numerical solution
virtual const Eigen::MatrixXd thrustForceNumericalJacobian(std::vector<int> joint_indices);
Expand Down

0 comments on commit 019813c

Please sign in to comment.