Last active
October 23, 2015 12:02
-
-
Save martinbeentjes/d40388a5ecbad67ad288 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ros/ros.h" | |
#include "mavros/RCIn.h" | |
#include "mavros/OverrideRCIn.h" | |
int c=0; | |
int __ct=0; | |
void rc_in_callback(mavros::RCIn); | |
void doSequence(ros::Publisher,int); | |
int main(int argc, char* argv[]) { | |
ros::init(argc, argv, "movetest"); | |
ros::NodeHandle __n; | |
ros::Subscriber rc_in_subscriber = __n.subscribe("/mavros/rc/in",1000,rc_in_callback); | |
ros::Publisher rc_pub = __n.advertise<mavros::OverrideRCIn>("/mavros/rc/override", 1000); | |
ros::Rate loop_rate(10); | |
int tc=0; | |
while(ros::ok()) { | |
doSequence(pub,1800); | |
ros::spinOnce(); | |
loop_rate.sleep(); | |
tc++; | |
} | |
return 0; | |
} | |
void rc_in_callback(mavros::RCIn msg) { | |
ROS_INFO("Channel 1: %d | Channel 3: %d",msg.channels[0], msg.channels[2]); | |
} | |
void doSequence(ros::Publisher pub, int c) { | |
// 1500, 1015, 1915, 1500 | |
mavros::OverrideRCIn msg; | |
msg.channels[0]=c; | |
pub.publish(msg); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment