Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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())
{
