Added the leak sensor and kill switch
Dependencies: mbed ros_lib_kinetic
Fork of Seadragon_motors_ros by
Revision 1:b07605144252, committed 2018-07-24
- Comitter:
- ElevatedSounds
- Date:
- Tue Jul 24 03:46:19 2018 +0000
- Parent:
- 0:5c809b850f21
- Commit message:
- This code implement motors control with PID and a leak sensor
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 5c809b850f21 -r b07605144252 main.cpp --- a/main.cpp Mon Jul 23 22:02:33 2018 +0000 +++ b/main.cpp Tue Jul 24 03:46:19 2018 +0000 @@ -55,6 +55,8 @@ std_msgs::Int16 depth_msg; int depth = 0; //std_msgs::Bool kill_msg; +std_msgs::Bool kill_msg; +ros::Publisher depth_publisher("depth", &depth_msg); ros::Publisher depth_publisher("depth", &depth_msg); //ros::Publisher killswitch_publisher("killswitch", &kill_msg); @@ -150,11 +152,33 @@ nh.subscribe(yaw_pwm_subscriber); nh.subscribe(fb_yaw_subscriber); nh.subscribe(fb_depth_subscriber); + nh.advertise(leak_publisher); + nh.advertise(killSwitch_publisher); testLed = 0; while(1) { + if(leakSensor) + { + leak_msg.data = 1; + } + else + { + leak_msg.data = 0; + } + leak_publisher.publish(&leak_msg); + + if(killSwitchSensor) + { + killSwitch_msg.data = 1; + } + else + { + killSwitch_msg.data = 0; + } + killSwitch_publisher.publish(&killSwitch_msg); + // If data is recieved, blink led if (device.readable()) {