33 #include <gazebo_msgs/SetModelState.h> 34 #include <std_srvs/Empty.h> 46 namespace_nh.
param<
double>(
"mass",
mass_, 3.61);
47 namespace_nh.
param<
double>(
"max_F", max_thrust, 64.50);
77 command_msg_.mode = pnh.
param<
int>(
"control_mode", (int)rosflight_msgs::Command::MODE_ROLL_PITCH_YAWRATE_THROTTLE);
133 gazebo_msgs::ModelState modelstate;
134 modelstate.model_name = (std::string)
mav_name_;
135 modelstate.reference_frame = (std::string)
"world";
140 gazebo_msgs::SetModelState setmodelstate;
141 setmodelstate.request.model_state = modelstate;
142 client.
call(setmodelstate);
152 std_srvs::Empty pauseSim;
153 client.
call(pauseSim);
163 std_srvs::Empty resumeSim;
164 client.
call(resumeSim);
213 if (
command_msg_.mode == rosflight_msgs::Command::MODE_PASS_THROUGH)
217 else if (
command_msg_.mode == rosflight_msgs::Command::MODE_ROLL_PITCH_YAWRATE_THROTTLE)
221 else if (
command_msg_.mode == rosflight_msgs::Command::MODE_ROLL_PITCH_YAWRATE_ALTITUDE)
225 else if (
command_msg_.mode == rosflight_msgs::Command::MODE_XVEL_YVEL_YAWRATE_ALTITUDE)
229 else if (
command_msg_.mode == rosflight_msgs::Command::MODE_XPOS_YPOS_YAW_ALTITUDE)
250 case rosflight_msgs::Command::MODE_ROLLRATE_PITCHRATE_YAWRATE_THROTTLE:
264 case rosflight_msgs::Command::MODE_ROLL_PITCH_YAWRATE_THROTTLE:
278 case rosflight_msgs::Command::MODE_ROLL_PITCH_YAWRATE_ALTITUDE:
287 case rosflight_msgs::Command::MODE_XVEL_YVEL_YAWRATE_ALTITUDE:
300 case rosflight_msgs::Command::MODE_XPOS_YPOS_YAW_ALTITUDE:
330 int main(
int argc,
char **argv)
332 ros::init(argc, argv,
"rosflight_utils_joy");
int main(int argc, char **argv)
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
double current_y_setpoint_
void publish(const boost::shared_ptr< M > &message) const
sensor_msgs::Joy current_joy_
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
geometry_msgs::Twist reset_twist_
rosflight_msgs::Command command_msg_
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool call(MReq &req, MRes &res)
ros::Subscriber autopilot_command_sub_
double equilibrium_thrust_
double current_x_setpoint_
ros::Publisher command_pub_
double current_yaw_setpoint_
std::string autopilot_command_topic_
void JoyCallback(const sensor_msgs::JoyConstPtr &msg)
ROSCPP_DECL const std::string & getNamespace()
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
const std::string & getNamespace() const
double current_altitude_setpoint_
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
rosflight_msgs::Command autopilot_command_
geometry_msgs::Pose reset_pose_
std::string command_topic_
void APCommandCallback(const rosflight_msgs::CommandConstPtr &msg)