From: <goo...@us...> - 2009-07-22 18:07:53
|
Revision: 19414 http://personalrobots.svn.sourceforge.net/personalrobots/?rev=19414&view=rev Author: goodfellow Date: 2009-07-22 18:07:45 +0000 (Wed, 22 Jul 2009) Log Message: ----------- Wrote "debugger" listener node since ROS_INFO doesn't work added launch files to switch the muxes Modified Paths: -------------- pkg/trunk/sandbox/person_data/CMakeLists.txt pkg/trunk/sandbox/person_data/data_collector_record.launch pkg/trunk/sandbox/person_data/person_data.launch pkg/trunk/sandbox/person_data/src/joylistener.cpp pkg/trunk/sandbox/person_data/startRecording.sh pkg/trunk/sandbox/person_data/stopRecording.sh Added Paths: ----------- pkg/trunk/sandbox/person_data/src/debugger.cpp pkg/trunk/sandbox/person_data/startRecording.launch pkg/trunk/sandbox/person_data/stopRecording.launch Removed Paths: ------------- pkg/trunk/sandbox/person_data/src/listener.cpp Modified: pkg/trunk/sandbox/person_data/CMakeLists.txt =================================================================== --- pkg/trunk/sandbox/person_data/CMakeLists.txt 2009-07-22 17:15:37 UTC (rev 19413) +++ pkg/trunk/sandbox/person_data/CMakeLists.txt 2009-07-22 18:07:45 UTC (rev 19414) @@ -30,5 +30,5 @@ #target_link_libraries(example ${PROJECT_NAME}) rospack_add_executable(talker src/talker.cpp) -rospack_add_executable(listener src/listener.cpp) +rospack_add_executable(debugger src/debugger.cpp) rospack_add_executable(joylistener src/joylistener.cpp) Modified: pkg/trunk/sandbox/person_data/data_collector_record.launch =================================================================== --- pkg/trunk/sandbox/person_data/data_collector_record.launch 2009-07-22 17:15:37 UTC (rev 19413) +++ pkg/trunk/sandbox/person_data/data_collector_record.launch 2009-07-22 18:07:45 UTC (rev 19414) @@ -18,7 +18,7 @@ <node pkg="topic_tools" type="mux" machine="two" args="/laser_tilt_controller/laser_scanner_signal_muxed /laser_tilt_controller/laser_scanner_signal"/> <node pkg="rosrecord" type="rosrecord" machine="two" args="-f /bags/person_data/laser_ /base_scan_muxed /tilt_scan_muxed /laser_tilt_controller/laser_scanner_signal"/> - <node pkg="topic_tools" type="mux" machine="two" args="/odom_muxed /odom"> + <node pkg="topic_tools" type="mux" machine="two" args="/odom_muxed /odom"/> <node pkg="rosrecord" type="rosrecord" machine="two" args="-f /bags/person_data/state_ /odom_muxed "/> </launch> Modified: pkg/trunk/sandbox/person_data/person_data.launch =================================================================== --- pkg/trunk/sandbox/person_data/person_data.launch 2009-07-22 17:15:37 UTC (rev 19413) +++ pkg/trunk/sandbox/person_data/person_data.launch 2009-07-22 18:07:45 UTC (rev 19414) @@ -1,6 +1,7 @@ <launch> +<node pkg="person_data" type="joylistener" output="screen"/> -<include file="$(find person_data)/data_collector_record.launch" /> +<include file="$(find person_data)/data_collector_record.launch" /> <include file="$(find person_data)/truly_passive.launch" /> <include file="$(find pr2_alpha)/teleop_joystick.launch" /> Copied: pkg/trunk/sandbox/person_data/src/debugger.cpp (from rev 19406, pkg/trunk/sandbox/person_data/src/listener.cpp) =================================================================== --- pkg/trunk/sandbox/person_data/src/debugger.cpp (rev 0) +++ pkg/trunk/sandbox/person_data/src/debugger.cpp 2009-07-22 18:07:45 UTC (rev 19414) @@ -0,0 +1,13 @@ +#include <ros/ros.h> +#include <std_msgs/String.h> +void chatterCallback(const std_msgs::StringConstPtr & msg) +{ + ROS_INFO("Received [%s]",msg->data.c_str()); +} +int main(int argc, char ** argv) +{ + ros::init(argc, argv, "debugger"); + ros::NodeHandle n; + ros::Subscriber chatter_sub = n.subscribe("ia3n_debug",100,chatterCallback); + ros::spin(); +} Property changes on: pkg/trunk/sandbox/person_data/src/debugger.cpp ___________________________________________________________________ Added: svn:mergeinfo + Modified: pkg/trunk/sandbox/person_data/src/joylistener.cpp =================================================================== --- pkg/trunk/sandbox/person_data/src/joylistener.cpp 2009-07-22 17:15:37 UTC (rev 19413) +++ pkg/trunk/sandbox/person_data/src/joylistener.cpp 2009-07-22 18:07:45 UTC (rev 19414) @@ -6,6 +6,7 @@ #include <ros/ros.h> #include <std_msgs/String.h> #include "joy/Joy.h" +#include <string> const static int headButton = 6; const static int deadmanButton = 4; @@ -16,7 +17,16 @@ static bool headButtonPressed = false; static bool deadmanButtonPressed = false; +ros::Publisher debug_pub; +void IA3N_INFO(const char * msg) +{ + std_msgs::String rmsg; + rmsg.data = std::string(msg); + debug_pub.publish(rmsg); + ROS_INFO(msg); +} + void startRecording() { FILE * result = popen("bash `rospack find person_data`/startRecording.sh","r"); @@ -31,43 +41,43 @@ recording = false; } + + void joyCallback(const joy::Joy::ConstPtr & msg) { + IA3N_INFO("Received joystick message!"); + int n = msg->get_buttons_size(); - if (headButton >= n || deadmanButton >= n || recordButton >= n || stopButton >= n) - { - ROS_INFO("Received message with too few buttons"); - return; - } + //messages are sized so that they are just long enough to include the last 1 - if (msg->buttons[headButton]) + if (headButton < n && msg->buttons[headButton]) { - ROS_INFO("Head button pushed down"); + IA3N_INFO("Head button pushed down"); headButtonPressed = true; } else { - ROS_INFO("Head button released"); + IA3N_INFO("Head button released"); headButtonPressed = false; } - if (msg->buttons[deadmanButton]) + if (deadmanButton < n && msg->buttons[deadmanButton]) { - ROS_INFO("Deadman button pushed down"); + IA3N_INFO("Deadman button pushed down"); deadmanButtonPressed = true; } else { - ROS_INFO("Deadman button released"); + IA3N_INFO("Deadman button released"); deadmanButtonPressed = false; } if (headButtonPressed && ! deadmanButtonPressed) { - if (msg->buttons[recordButton]) + if (recordButton < n && msg->buttons[recordButton]) { if (!recording) { @@ -75,11 +85,11 @@ } else { - ROS_INFO("You are already recording!"); + IA3N_INFO("You are already recording!"); } } - if (msg->buttons[stopButton]) + if (stopButton < n && msg->buttons[stopButton]) { if (recording) { @@ -87,7 +97,7 @@ } else { - ROS_INFO("You have already stopped recording"); + IA3N_INFO("You have already stopped recording"); } } } @@ -96,7 +106,7 @@ //for ( int i = 0; i < n; i++) //{ // if (msg->buttons[i]) - // ROS_INFO("Button %d pressed",i); + // IA3N_INFO("Button %d pressed",i); //} } @@ -104,6 +114,8 @@ { ros::init(argc, argv, "joylistener"); ros::NodeHandle n; + debug_pub = n.advertise<std_msgs::String>("ia3n_debug",100); ros::Subscriber chatter_sub = n.subscribe("joy",100,joyCallback); + IA3N_INFO("joylistener subscribed to joy"); ros::spin(); } Deleted: pkg/trunk/sandbox/person_data/src/listener.cpp =================================================================== --- pkg/trunk/sandbox/person_data/src/listener.cpp 2009-07-22 17:15:37 UTC (rev 19413) +++ pkg/trunk/sandbox/person_data/src/listener.cpp 2009-07-22 18:07:45 UTC (rev 19414) @@ -1,13 +0,0 @@ -#include <ros/ros.h> -#include <std_msgs/String.h> -void chatterCallback(const std_msgs::StringConstPtr & msg) -{ - ROS_INFO("Received [%s]",msg->data.c_str()); -} -int main(int argc, char ** argv) -{ - ros::init(argc, argv, "listener"); - ros::NodeHandle n; - ros::Subscriber chatter_sub = n.subscribe("chatter",100,chatterCallback); - ros::spin(); -} Added: pkg/trunk/sandbox/person_data/startRecording.launch =================================================================== --- pkg/trunk/sandbox/person_data/startRecording.launch (rev 0) +++ pkg/trunk/sandbox/person_data/startRecording.launch 2009-07-22 18:07:45 UTC (rev 19414) @@ -0,0 +1,11 @@ +<launch> +<include file="$(find pr2_alpha)/$(env ROBOT).machine" /> +<node pkg="topic_tools" type="switch_mux" args="/wide_stereo/raw_stereo_muxed /wide_stereo/raw_stereo" machine="four"/> +<node pkg="topic_tools" type="switch_mux" args="/narrow_stereo/raw_stereo_muxed /narrow_stereo/raw_stereo" machine="four"/> +<node pkg="topic_tools" type="switch_mux" args="/tf_message_muxed /tf_message" machine="two"/> +<node pkg="topic_tools" type="switch_mux" machine="two" args="/mechanism_state_muxed /mechanism_state"/> +<node pkg="topic_tools" type="switch_mux" machine="two" args="/base_scan_muxed /base_scan"/> +<node pkg="topic_tools" type="switch_mux" machine="two" args="/tilt_scan_muxed /tilt_scan"/> +<node pkg="topic_tools" type="switch_mux" machine="two" args="/laser_tilt_controller/laser_scanner_signal_muxed /laser_tilt_controller/laser_scanner_signal"/> +<node pkg="topic_tools" type="switch_mux" machine="two" args="/odom_muxed /odom"/> +</launch> Modified: pkg/trunk/sandbox/person_data/startRecording.sh =================================================================== --- pkg/trunk/sandbox/person_data/startRecording.sh 2009-07-22 17:15:37 UTC (rev 19413) +++ pkg/trunk/sandbox/person_data/startRecording.sh 2009-07-22 18:07:45 UTC (rev 19414) @@ -1 +1 @@ -echo "startRecording.sh doesn't do anything yet" +roslaunch start_recording.launch Added: pkg/trunk/sandbox/person_data/stopRecording.launch =================================================================== --- pkg/trunk/sandbox/person_data/stopRecording.launch (rev 0) +++ pkg/trunk/sandbox/person_data/stopRecording.launch 2009-07-22 18:07:45 UTC (rev 19414) @@ -0,0 +1,10 @@ +<launch> +<node pkg="topic_tools" type="switch_mux" args="/wide_stereo/raw_stereo_muxed /dummy" machine="four"/> +<node pkg="topic_tools" type="switch_mux" args="/narrow_stereo/raw_stereo_muxed /dummy" machine="four"/> +<node pkg="topic_tools" type="switch_mux" args="/tf_message_muxed /dummy" machine="two"/> +<node pkg="topic_tools" type="switch_mux" machine="two" args="/mechanism_state_muxed /dummy"/> +<node pkg="topic_tools" type="switch_mux" machine="two" args="/base_scan_muxed /dummy"/> +<node pkg="topic_tools" type="switch_mux" machine="two" args="/tilt_scan_muxed /dummy"/> +<node pkg="topic_tools" type="switch_mux" machine="two" args="/laser_tilt_controller/laser_scanner_signal_muxed /dummy"/> +<node pkg="topic_tools" type="switch_mux" machine="two" args="/odom_muxed /dummy"> +</launch> Modified: pkg/trunk/sandbox/person_data/stopRecording.sh =================================================================== --- pkg/trunk/sandbox/person_data/stopRecording.sh 2009-07-22 17:15:37 UTC (rev 19413) +++ pkg/trunk/sandbox/person_data/stopRecording.sh 2009-07-22 18:07:45 UTC (rev 19414) @@ -1 +1 @@ -echo "stopRecording.sh doesn't do anything yet" +roslaunch stopRecording.launch This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |