Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix thrust_direction
  • Loading branch information
mengchaoheng committed Apr 24, 2022
commit 28ec88be7ce631ef0cbcc59b3a1ee9ad41f23d16
9 changes: 6 additions & 3 deletions rotors_joy_interface/src/joy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,17 @@ void Joy::JoyCallback(const sensor_msgs::JoyConstPtr& msg) {
else {
current_yaw_vel_ = 0;
}
control_msg_.yaw_rate = current_yaw_vel_;

control_msg_.yaw_rate = msg->axes[3] * max_.rate_yaw ;
ROS_INFO("hello world! %d", axes_.thrust_direction);
if (is_fixed_wing_) {
double thrust = msg->axes[axes_.thrust] * axes_.thrust_direction;
control_msg_.thrust.x = (thrust >= 0.0) ? thrust : 0.0;
}
else {
control_msg_.thrust.z = (msg->axes[axes_.thrust] + 1) * max_.thrust / 2.0 * axes_.thrust_direction;
control_msg_.thrust.z = (msg->axes[axes_.thrust] * axes_.thrust_direction + 1) * max_.thrust / 2.0 ;



}

ros::Time update_time = ros::Time::now();
Expand Down