From c1b6b89cc00a0e2b77e0b3283773492b85114686 Mon Sep 17 00:00:00 2001 From: ros Date: Sat, 13 Aug 2016 15:40:39 +1000 Subject: [PATCH 1/4] OWRS-257 #Time 4h ready to test --- gui/src/owr_gui/include/NavigationGUI.h | 3 + gui/src/owr_gui/include/NavigationNode.h | 4 + gui/src/owr_gui/src/NavigationGUI.cpp | 19 ++ gui/src/owr_gui/src/NavigationNode.cpp | 11 ++ rover/src/owr_mtig/CMakeLists.txt | 169 ------------------ rover/src/owr_mtig/launch/mtig_driver.launch | 37 ---- rover/src/owr_mtig/package.xml | 61 ------- .../src/VoltmeterMonitor.cpp | 6 +- 8 files changed, 40 insertions(+), 270 deletions(-) delete mode 100755 rover/src/owr_mtig/CMakeLists.txt delete mode 100755 rover/src/owr_mtig/launch/mtig_driver.launch delete mode 100755 rover/src/owr_mtig/package.xml diff --git a/gui/src/owr_gui/include/NavigationGUI.h b/gui/src/owr_gui/include/NavigationGUI.h index 44f39569..f2482f57 100644 --- a/gui/src/owr_gui/include/NavigationGUI.h +++ b/gui/src/owr_gui/include/NavigationGUI.h @@ -59,6 +59,7 @@ class NavigationGUI : public GLUTWindow { public: NavigationGUI(int width, int height, int *argc, char **argv); void updateInfo(float battery, float signal, float ultrasonic, ListNode current, vector3D target); + void updateVoltage(float voltage); void updateVideo(unsigned char *frame, int width, int height); void updateFeedsStatus(unsigned char *feeds, int numOnline); @@ -94,6 +95,7 @@ class NavigationGUI : public GLUTWindow { void drawBattery(); void drawSignal(); void drawUltrasonic(); + void drawVolts(); // pointer to the ROS handler void *navigationNode; @@ -104,6 +106,7 @@ class NavigationGUI : public GLUTWindow { float tiltX; // tilt of left-right in degrees float tiltY; // tilt of forward-back in degrees float ultrasonic; + float voltage; // voltage from voltmeter vector3D currentPos; double pathRotation; // angle to rotate GPS path when drawing diff --git a/gui/src/owr_gui/include/NavigationNode.h b/gui/src/owr_gui/include/NavigationNode.h index 6bf66004..989310a4 100644 --- a/gui/src/owr_gui/include/NavigationNode.h +++ b/gui/src/owr_gui/include/NavigationNode.h @@ -12,6 +12,7 @@ #include #include #include "owr_messages/status.h" +#include "owr_messages/voltage.h" #include "NavigationGUI.h" #include @@ -28,6 +29,7 @@ class NavigationNode { void receiveGpsMsg(const sensor_msgs::NavSatFix::ConstPtr& msg); void receiveBatteryMsg(const owr_messages::status::ConstPtr& msg); void receiveVideoMsg(const sensor_msgs::Image::ConstPtr& msg); + void receiveVoltageMsg(const owr_messages::voltage::ConstPtr& msg); private: NavigationGUI *gui; @@ -35,12 +37,14 @@ class NavigationNode { ros::Subscriber batterySub; image_transport::Subscriber videoSub[TOTAL_FEEDS]; ros::Subscriber feedsSub; + ros::Subscriber voltSub; // voltmeter callback float battery; float signal; float tiltX; float tiltY; float ultrasonic; + float voltage; double altitude; unsigned char feeds[TOTAL_FEEDS]; vector3D target; diff --git a/gui/src/owr_gui/src/NavigationGUI.cpp b/gui/src/owr_gui/src/NavigationGUI.cpp index ae270b0b..fefa3b62 100644 --- a/gui/src/owr_gui/src/NavigationGUI.cpp +++ b/gui/src/owr_gui/src/NavigationGUI.cpp @@ -86,6 +86,10 @@ void NavigationGUI::updateInfo(float bat, float sig, float ultrason, ListNode cu //ROS_INFO("Updated info"); } +void NavigationGUI::updateVoltage(float volts) { + voltage = volts; +} + void NavigationGUI::updateVideo(unsigned char *frame, int width, int height) { // use the Video_Feed_Frame object method videoScreen->setNewStreamFrame(frame, width, height); @@ -177,6 +181,7 @@ void NavigationGUI::display() { drawBattery(); drawSignal(); drawUltrasonic(); + drawVolts(); } glutSwapBuffers(); @@ -577,3 +582,17 @@ void NavigationGUI::special_keyup(int keycode, int x, int y) { void NavigationGUI::keyup(unsigned char key, int x, int y) { } + +// draw Voltage +void NavigationGUI::drawVolts() { + glPushMatrix(); + + char text[30]; + + glTranslated(currWinW/2.0-30,-50, 0); + glColor4f(1, 0, 0, ALPHA); + sprintf(text, "%.2fV", voltage); + drawText(text, GLUT_BITMAP_TIMES_ROMAN_24, 0, 0); + + glPopMatrix(); +} \ No newline at end of file diff --git a/gui/src/owr_gui/src/NavigationNode.cpp b/gui/src/owr_gui/src/NavigationNode.cpp index 0e4b44c0..8e80c191 100644 --- a/gui/src/owr_gui/src/NavigationNode.cpp +++ b/gui/src/owr_gui/src/NavigationNode.cpp @@ -41,6 +41,8 @@ NavigationNode::NavigationNode(NavigationGUI *newgui) { gpsSub = n.subscribe("/gps/fix", 1000, &NavigationNode::receiveGpsMsg, this); // GPS related data batterySub = n.subscribe("/status/battery", 1000, &NavigationNode::receiveBatteryMsg, this); // Power left on the battery feedsSub = n.subscribe("/owr/control/availableFeeds", 1000, &NavigationNode::receiveFeedsStatus, this); + voltSub = n.subscribe("/voltmeter", 1000, &NavigationNode::receiveVoltageMsg, this); + // Subscribe to all topics that will be published to by cameras, if the topic hasnt been // created yet, will wait til it has w/o doing anything @@ -126,3 +128,12 @@ void NavigationNode::receiveVideoMsg(const sensor_msgs::Image::ConstPtr& msg) { gui->updateVideo((unsigned char *)msg->data.data(), msg->width, msg->height); } + +void NavigationNode::receiveVoltageMsg(const owr_messages::voltage::ConstPtr& msg) { + assert(msg); // + + //ROS_INFO("received a message"); + //ROS_INFO("voltage %f", msg->voltage); + voltage = msg->voltage; + gui->updateVoltage(voltage); +} \ No newline at end of file diff --git a/rover/src/owr_mtig/CMakeLists.txt b/rover/src/owr_mtig/CMakeLists.txt deleted file mode 100755 index ac57f673..00000000 --- a/rover/src/owr_mtig/CMakeLists.txt +++ /dev/null @@ -1,169 +0,0 @@ -cmake_minimum_required(VERSION 2.8.3) -project(owr_mtig) - -## Find catkin macros and libraries -## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) -## is used, also find other catkin packages -find_package(catkin REQUIRED COMPONENTS - owr_messages - roscpp - rospy - std_msgs -) - -## System dependencies are found with CMake's conventions -# find_package(Boost REQUIRED COMPONENTS system) - - -## Uncomment this if the package has a setup.py. This macro ensures -## modules and global scripts declared therein get installed -## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html -# catkin_python_setup() - -################################################ -## Declare ROS messages, services and actions ## -################################################ - -## To declare and build messages, services or actions from within this -## package, follow these steps: -## * Let MSG_DEP_SET be the set of packages whose message types you use in -## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). -## * In the file package.xml: -## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET -## * If MSG_DEP_SET isn't empty the following dependencies might have been -## pulled in transitively but can be declared for certainty nonetheless: -## * add a build_depend tag for "message_generation" -## * add a run_depend tag for "message_runtime" -## * In this file (CMakeLists.txt): -## * add "message_generation" and every package in MSG_DEP_SET to -## find_package(catkin REQUIRED COMPONENTS ...) -## * add "message_runtime" and every package in MSG_DEP_SET to -## catkin_package(CATKIN_DEPENDS ...) -## * uncomment the add_*_files sections below as needed -## and list every .msg/.srv/.action file to be processed -## * uncomment the generate_messages entry below -## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) - -## Generate messages in the 'msg' folder -# add_message_files( -# FILES -# Message1.msg -# Message2.msg -# ) - -## Generate services in the 'srv' folder -# add_service_files( -# FILES -# Service1.srv -# Service2.srv -# ) - -## Generate actions in the 'action' folder -# add_action_files( -# FILES -# Action1.action -# Action2.action -# ) - -## Generate added messages and services with any dependencies listed here -# generate_messages( -# DEPENDENCIES -# std_msgs -# ) - -################################### -## catkin specific configuration ## -################################### -## The catkin_package macro generates cmake config files for your package -## Declare things to be passed to dependent projects -## INCLUDE_DIRS: uncomment this if you package contains header files -## LIBRARIES: libraries you create in this project that dependent projects also need -## CATKIN_DEPENDS: catkin_packages dependent projects also need -## DEPENDS: system dependencies of this project that dependent projects also need -catkin_package( - INCLUDE_DIRS include - LIBRARIES owr_mtig - CATKIN_DEPENDS owr_messages roscpp rospy std_msgs - DEPENDS system_lib -) - -########### -## Build ## -########### - -## Specify additional locations of header files -## Your package locations should be listed before other locations -# include_directories(include) -include_directories( - include - ${catkin_INCLUDE_DIRS} -) - -## Declare a cpp library -# add_library(owr_drive_controls -# src/${PROJECT_NAME}/owr_drive_controls.cpp -# ) - -## Declare a cpp executable - -#Example -#add_executable(owr_mtig_node src/.cpp) -#target_link_libraries(owr_mtig_node ${catkin_LIBRARIES}) - - -## Add cmake target dependencies of the executable/library -## as an example, message headers may need to be generated before nodes -# add_dependencies(owr_drive_controls_node owr_drive_controls_generate_messages_cpp) - -## Specify libraries to link a library or executable target against -# target_link_libraries(owr_drive_controls_node -# ${catkin_LIBRARIES} -# ) - -############# -## Install ## -############# - -# all install targets should use catkin DESTINATION variables -# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html - -## Mark executable scripts (Python etc.) for installation -## in contrast to setup.py, you can choose the destination -# install(PROGRAMS -# scripts/my_python_script -# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) - -## Mark executables and/or libraries for installation -# install(TARGETS owr_drive_controls owr_drive_controls_node -# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) - -## Mark cpp header files for installation -# install(DIRECTORY include/${PROJECT_NAME}/ -# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} -# FILES_MATCHING PATTERN "*.h" -# PATTERN ".svn" EXCLUDE -# ) - -## Mark other files for installation (e.g. launch and bag files, etc.) -# install(FILES -# # myfile1 -# # myfile2 -# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} -# ) - -############# -## Testing ## -############# - -## Add gtest based cpp test target and link libraries -# catkin_add_gtest(${PROJECT_NAME}-test test/test_owr_drive_controls.cpp) -# if(TARGET ${PROJECT_NAME}-test) -# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) -# endif() - -## Add folders to be run by python nosetests -# catkin_add_nosetests(test) diff --git a/rover/src/owr_mtig/launch/mtig_driver.launch b/rover/src/owr_mtig/launch/mtig_driver.launch deleted file mode 100755 index 5405057c..00000000 --- a/rover/src/owr_mtig/launch/mtig_driver.launch +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/rover/src/owr_mtig/package.xml b/rover/src/owr_mtig/package.xml deleted file mode 100755 index a0d1d2f1..00000000 --- a/rover/src/owr_mtig/package.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - owr_mtig - 0.0.0 - The owr_mtig package - - - - - ros - - - - - - TODO - - - - - - - - - - - - - - - - - - - - - - - - - - catkin - owr_messages - roscpp - rospy - std_msgs - owr_messages - roscpp - rospy - std_msgs - - - - - - - - - - - diff --git a/rover/src/owr_voltmeter_monitor/src/VoltmeterMonitor.cpp b/rover/src/owr_voltmeter_monitor/src/VoltmeterMonitor.cpp index a8762ed1..f42072a2 100644 --- a/rover/src/owr_voltmeter_monitor/src/VoltmeterMonitor.cpp +++ b/rover/src/owr_voltmeter_monitor/src/VoltmeterMonitor.cpp @@ -27,11 +27,11 @@ VoltmeterMonitor::VoltmeterMonitor() : node() { subscriber = node.subscribe("/owr/adc", 2, &VoltmeterMonitor::callback, this); publisher = node.advertise("/owr/voltmeter", 10); - node.getParam("voltmeter_offset", voltmeterOffset); +// node.getParam("voltmeter_offset", voltmeterOffset); voltmeterScale = 0.000609756097; - node.getParam("voltmeter_scale", voltmeterScale); +// node.getParam("voltmeter_scale", voltmeterScale); voltmeterFrame = "pot2"; //default value - node.getParam("voltmeter_frame", voltmeterFrame); +// node.getParam("voltmeter_frame", voltmeterFrame); ROS_INFO("Running with scale %f and offset %f", voltmeterScale, voltmeterOffset); } From a5fc32367fcb36d1df2044e28ee5faee24e05c29 Mon Sep 17 00:00:00 2001 From: ros Date: Sat, 13 Aug 2016 15:47:10 +1000 Subject: [PATCH 2/4] blah --- gui/src/owr_gui/src/NavigationNode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/owr_gui/src/NavigationNode.cpp b/gui/src/owr_gui/src/NavigationNode.cpp index 8e80c191..de131025 100644 --- a/gui/src/owr_gui/src/NavigationNode.cpp +++ b/gui/src/owr_gui/src/NavigationNode.cpp @@ -136,4 +136,4 @@ void NavigationNode::receiveVoltageMsg(const owr_messages::voltage::ConstPtr& ms //ROS_INFO("voltage %f", msg->voltage); voltage = msg->voltage; gui->updateVoltage(voltage); -} \ No newline at end of file +} From 93538cdc1e9cb8d983a6cf4b00cb5fe247aa40bd Mon Sep 17 00:00:00 2001 From: Harry Date: Wed, 24 Aug 2016 19:21:59 +1000 Subject: [PATCH 3/4] OWRS-257 #time 15m fixed topic and message type is working now #done --- gui/src/owr_gui/include/NavigationNode.h | 3 ++- gui/src/owr_gui/src/NavigationNode.cpp | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gui/src/owr_gui/include/NavigationNode.h b/gui/src/owr_gui/include/NavigationNode.h index 989310a4..10e7a568 100644 --- a/gui/src/owr_gui/include/NavigationNode.h +++ b/gui/src/owr_gui/include/NavigationNode.h @@ -15,6 +15,7 @@ #include "owr_messages/voltage.h" #include "NavigationGUI.h" #include +#include // The message structs needed for availableFeeds #include "owr_messages/activeCameras.h" @@ -29,7 +30,7 @@ class NavigationNode { void receiveGpsMsg(const sensor_msgs::NavSatFix::ConstPtr& msg); void receiveBatteryMsg(const owr_messages::status::ConstPtr& msg); void receiveVideoMsg(const sensor_msgs::Image::ConstPtr& msg); - void receiveVoltageMsg(const owr_messages::voltage::ConstPtr& msg); + void receiveVoltageMsg(const std_msgs::Float32::ConstPtr& msg); private: NavigationGUI *gui; diff --git a/gui/src/owr_gui/src/NavigationNode.cpp b/gui/src/owr_gui/src/NavigationNode.cpp index 15116d37..43c745ba 100644 --- a/gui/src/owr_gui/src/NavigationNode.cpp +++ b/gui/src/owr_gui/src/NavigationNode.cpp @@ -41,7 +41,7 @@ NavigationNode::NavigationNode(NavigationGUI *newgui) { gpsSub = n.subscribe("/gps/fix", 1000, &NavigationNode::receiveGpsMsg, this); // GPS related data batterySub = n.subscribe("/status/battery", 1000, &NavigationNode::receiveBatteryMsg, this); // Power left on the battery feedsSub = n.subscribe("/owr/control/availableFeeds", 1000, &NavigationNode::receiveFeedsStatus, this); - voltSub = n.subscribe("/voltmeter", 1000, &NavigationNode::receiveVoltageMsg, this); + voltSub = n.subscribe("/owr/voltmeter", 1000, &NavigationNode::receiveVoltageMsg, this); // Subscribe to all topics that will be published to by cameras, if the topic hasnt been @@ -133,11 +133,12 @@ void NavigationNode::receiveVideoMsg(const sensor_msgs::Image::ConstPtr& msg) { gui->updateVideo((unsigned char *)msg->data.data(), msg->width, msg->height); } -void NavigationNode::receiveVoltageMsg(const owr_messages::voltage::ConstPtr& msg) { +void NavigationNode::receiveVoltageMsg(const std_msgs::Float32::ConstPtr& msg) { assert(msg); // //ROS_INFO("received a message"); //ROS_INFO("voltage %f", msg->voltage); - voltage = msg->voltage; + voltage = msg->data; gui->updateVoltage(voltage); + ROS_INFO("voltage %f", voltage); } From bf65bfffaebc72ed07ca8595d8b01857353ded15 Mon Sep 17 00:00:00 2001 From: ros Date: Thu, 8 Sep 2016 01:42:31 +1000 Subject: [PATCH 4/4] OWRS-297 #time 6h Completed displaying claw numbers in green box. --- gui/src/owr_gui/include/NavigationGUI.h | 6 ++++- gui/src/owr_gui/include/NavigationNode.h | 10 ++++++-- gui/src/owr_gui/src/NavigationGUI.cpp | 31 +++++++++++++++++++++++- gui/src/owr_gui/src/NavigationNode.cpp | 31 ++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 4 deletions(-) diff --git a/gui/src/owr_gui/include/NavigationGUI.h b/gui/src/owr_gui/include/NavigationGUI.h index 7f7b9590..6a08ec50 100644 --- a/gui/src/owr_gui/include/NavigationGUI.h +++ b/gui/src/owr_gui/include/NavigationGUI.h @@ -62,6 +62,7 @@ class NavigationGUI : public GLUTWindow { void updateVoltage(float voltage); void updateVideo(unsigned char *frame, int width, int height); void updateFeedsStatus(unsigned char *feeds, int numOnline); + void updateADC(float effort, float actual, float target); private: // GLUT essential functions @@ -96,7 +97,7 @@ class NavigationGUI : public GLUTWindow { void drawSignal(); void drawUltrasonic(); void drawVolts(); - + void drawADC(); // pointer to the ROS handler void *navigationNode; @@ -107,6 +108,9 @@ class NavigationGUI : public GLUTWindow { float tiltY; // tilt of forward-back in degrees float ultrasonic; float voltage; // voltage from voltmeter + float actual_claw; + float effort_claw; + float target_claw; vector3D currentPos; double pathRotation; // angle to rotate GPS path when drawing diff --git a/gui/src/owr_gui/include/NavigationNode.h b/gui/src/owr_gui/include/NavigationNode.h index 10e7a568..b038262b 100644 --- a/gui/src/owr_gui/include/NavigationNode.h +++ b/gui/src/owr_gui/include/NavigationNode.h @@ -13,10 +13,12 @@ #include #include "owr_messages/status.h" #include "owr_messages/voltage.h" +#include "owr_messages/adc.h" #include "NavigationGUI.h" #include #include - +#include +#include // for finding the right value // The message structs needed for availableFeeds #include "owr_messages/activeCameras.h" #include "owr_messages/stream.h" @@ -31,6 +33,7 @@ class NavigationNode { void receiveBatteryMsg(const owr_messages::status::ConstPtr& msg); void receiveVideoMsg(const sensor_msgs::Image::ConstPtr& msg); void receiveVoltageMsg(const std_msgs::Float32::ConstPtr& msg); + void receiveClawMsg(const owr_messages::adc::ConstPtr& msg); private: NavigationGUI *gui; @@ -39,13 +42,16 @@ class NavigationNode { image_transport::Subscriber videoSub[TOTAL_FEEDS]; ros::Subscriber feedsSub; ros::Subscriber voltSub; // voltmeter callback - + ros::Subscriber adcSub; // adc callback + float battery; float signal; float tiltX; float tiltY; float ultrasonic; float voltage; + std::vector pot_vals; + std::vector pot_names; double altitude; unsigned char feeds[TOTAL_FEEDS]; vector3D target; diff --git a/gui/src/owr_gui/src/NavigationGUI.cpp b/gui/src/owr_gui/src/NavigationGUI.cpp index 2d655577..41737559 100644 --- a/gui/src/owr_gui/src/NavigationGUI.cpp +++ b/gui/src/owr_gui/src/NavigationGUI.cpp @@ -90,6 +90,12 @@ void NavigationGUI::updateVoltage(float volts) { voltage = volts; } +void NavigationGUI::updateADC(float effort, float actual, float target) { + actual_claw = actual; + effort_claw = effort; + target_claw = target; +} + void NavigationGUI::updateVideo(unsigned char *frame, int width, int height) { // use the Video_Feed_Frame object method videoScreen->setNewStreamFrame(frame, width, height); @@ -182,6 +188,7 @@ void NavigationGUI::display() { drawSignal(); drawUltrasonic(); drawVolts(); + drawADC(); } glutSwapBuffers(); @@ -595,4 +602,26 @@ void NavigationGUI::drawVolts() { drawText(text, GLUT_BITMAP_TIMES_ROMAN_24, 0, 0); glPopMatrix(); -} +} + + +void NavigationGUI::drawADC() { + + glPushMatrix(); + glTranslated(currWinW - currWinW/10.0, -currWinH/2.0, 0); + glColor4f(0, 1, 0, TEXTBOX_ALPHA); + glBegin(GL_QUADS); + glVertex2d(-10, 24); + glVertex2d(-10, -75); + glVertex2d(200, -75); + glVertex2d(200, 24); + glEnd(); + + char text[60]; + glColor4f(1, 0, 0, ALPHA); + sprintf(text, "Target: %.2f \nActual: %.2f \nEffort: %.2f",target_claw, actual_claw, effort_claw); + drawText(text, GLUT_BITMAP_TIMES_ROMAN_24, 0, 0); + + glPopMatrix(); + +} \ No newline at end of file diff --git a/gui/src/owr_gui/src/NavigationNode.cpp b/gui/src/owr_gui/src/NavigationNode.cpp index 43c745ba..3233396b 100644 --- a/gui/src/owr_gui/src/NavigationNode.cpp +++ b/gui/src/owr_gui/src/NavigationNode.cpp @@ -42,6 +42,7 @@ NavigationNode::NavigationNode(NavigationGUI *newgui) { batterySub = n.subscribe("/status/battery", 1000, &NavigationNode::receiveBatteryMsg, this); // Power left on the battery feedsSub = n.subscribe("/owr/control/availableFeeds", 1000, &NavigationNode::receiveFeedsStatus, this); voltSub = n.subscribe("/owr/voltmeter", 1000, &NavigationNode::receiveVoltageMsg, this); + adcSub = n.subscribe("/owr/adc", 1000, &NavigationNode::receiveClawMsg, this); // Subscribe to all topics that will be published to by cameras, if the topic hasnt been @@ -142,3 +143,33 @@ void NavigationNode::receiveVoltageMsg(const std_msgs::Float32::ConstPtr& msg) { gui->updateVoltage(voltage); ROS_INFO("voltage %f", voltage); } + +void NavigationNode::receiveClawMsg(const owr_messages::adc::ConstPtr& msg) { + + assert(msg); + pot_vals = msg->pot; + pot_names = msg->potFrame; + + int effort_index; + int target_index; + int actual_index; + + effort_index = find(pot_names.begin(), pot_names.end(), "clawEffort") - pot_names.begin(); + target_index = find(pot_names.begin(), pot_names.end(), "clawGrip") - pot_names.begin(); + actual_index = find(pot_names.begin(), pot_names.end(), "clawActual") - pot_names.begin(); + + float effort = pot_vals[effort_index]; + float actual = pot_vals[actual_index]; + float target = pot_vals[target_index]; + + ROS_INFO("EFFORT: %f", effort); + ROS_INFO("ACTUAL: %f", actual); + ROS_INFO("TARGET: %f", target); + + ROS_INFO("EFFORT INDEX: %d", effort_index); + ROS_INFO("ACTUAL INDEX: %d", actual_index); + ROS_INFO("TARGET INDEX: %d", target_index); + + gui->updateADC(effort, actual, target); + +}