Skip to content

Commit

Permalink
[dragon] change desire coord interface for robot model to quaternion
Browse files Browse the repository at this point in the history
  • Loading branch information
sugikazu75 committed Apr 13, 2024
1 parent 019813c commit 9384e00
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion robots/dragon/include/dragon/dragon_navigation.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <aerial_robot_control/flight_navigation.h>
#include <sensor_msgs/JointState.h>
#include <spinal/DesireCoord.h>
#include <geometry_msgs/Quaternion.h>

namespace aerial_robot_navigation
{
Expand Down Expand Up @@ -72,7 +73,6 @@ namespace aerial_robot_navigation
void rosParamInit() override;

void setFinalTargetBaselinkRotCallback(const spinal::DesireCoordConstPtr & msg);
void targetBaselinkRotCallback(const spinal::DesireCoordConstPtr& msg);

/* target baselink rotation */
double prev_rotation_stamp_;
Expand Down
8 changes: 4 additions & 4 deletions robots/dragon/src/dragon_navigation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void DragonNavigator::initialize(ros::NodeHandle nh, ros::NodeHandle nhp,
/* initialize the flight control */
BaseNavigator::initialize(nh, nhp, robot_model, estimator, loop_du);

curr_target_baselink_rot_pub_ = nh_.advertise<spinal::DesireCoord>("desire_coordinate", 1);
curr_target_baselink_rot_pub_ = nh_.advertise<geometry_msgs::Quaternion>("desire_coordinate", 1);
joint_control_pub_ = nh_.advertise<sensor_msgs::JointState>("joints_ctrl", 1);
final_target_baselink_rot_sub_ = nh_.subscribe("final_target_baselink_rot", 1, &DragonNavigator::setFinalTargetBaselinkRotCallback, this);

Expand Down Expand Up @@ -55,9 +55,9 @@ void DragonNavigator::baselinkRotationProcess()
else
curr_target_baselink_rot_ = final_target_baselink_rot_;

spinal::DesireCoord target_baselink_rot_msg;
target_baselink_rot_msg.roll = curr_target_baselink_rot_.x();
target_baselink_rot_msg.pitch = curr_target_baselink_rot_.y();
KDL::Rotation rot = KDL::Rotation::RPY(curr_target_baselink_rot_.x(), curr_target_baselink_rot_.y(), 0);
geometry_msgs::Quaternion target_baselink_rot_msg;
rot.GetQuaternion(target_baselink_rot_msg.x, target_baselink_rot_msg.y, target_baselink_rot_msg.z, target_baselink_rot_msg.w);
curr_target_baselink_rot_pub_.publish(target_baselink_rot_msg);

prev_rotation_stamp_ = ros::Time::now().toSec();
Expand Down

0 comments on commit 9384e00

Please sign in to comment.