strange connection problem between two nodes [closed]
hi,
i wrote a gui-program, but in rxgraph there is no connection established between the 2 nodes: image rxgraph
gui:
- advertises: p2os_driver/MotorState "cmd_motor_state"
- ...
p2os_driver
- subscribes: p2os_driver/MotorState "cmd_motor_state"
if I start rostopic echo /cmd_motor_state -> connection between the gui-node and the rostopic node is established, and the message from the gui-node is printed on the screen without any problem.
if I start p2os_dashboard (also advertises cmd_motor_state) the connection between the p2os_driver or rostopic-node and p2os_dashboard is established - everything works fine. (but written in py)
But the communication between the gui-node and p2os_driver doesn't work...
gui-program:
ros::Publisher cmd_motorState;
//header
cmd_motorState = n.advertise<p2os_driver::MotorState>("cmd_motor_state", 100);
motorStateValue.state = (int)1;
cmd_motorState.publish(motorStateValue);
p2os_driver (no changes made by me)
cmdmstate_sub_ = n.subscribe("cmd_motor_state", 1, &P2OSNode::cmdmotor_state,this);
void P2OSNode::cmdmotor_state( const p2os_driver::MotorStateConstPtr &msg)
I would appreciate any help
thanks
R.
edit: info about the nodes
Node [/p3aat_gui]
Publications:
* /p3aat_gui [std_msgs/String]
* /cmd_motor_state [p2os_driver/MotorState]
* /rosout [rosgraph_msgs/Log]
Subscriptions:
* /p3aat [std_msgs/String]
* /front_laser [unknown type]
* /sonar [p2os_driver/SonarArray]
* /motor_state [p2os_driver/MotorState]
* /battery_state [p2os_driver/BatteryState]
* /Laser_Camera [sensor_msgs/LaserScan]
Services:
* /p3aat_gui/get_loggers
* /p3aat_gui/set_logger_level
contacting node http://localhost:41399/ ...
Pid: 20774
Connections:
* topic: /cmd_motor_state
* to: /rostopic_20972_1347372653882
* direction: outbound
* transport: TCPROS
* topic: /p3aat_gui
* to: /p3aat
* direction: outbound
* transport: TCPROS
* topic: /p3aat
* to: http://richard-ThinkPad-X200-Tablet:38498/
* direction: inbound
* transport: TCPROS
* topic: /Laser_Camera
* to: http://ros-mobile:36003/
* direction: inbound
* transport: TCPROS
* topic: /sonar
* to: http://ros-mobile:59172/
* direction: inbound
* transport: TCPROS
* topic: /battery_state
* to: http://ros-mobile:59172/
* direction: inbound
* transport: TCPROS
* topic: /motor_state
* to: http://ros-mobile:59172/
* direction: inbound
* transport: TCPROS
Node [/p2os]
Publications:
* /sonar [p2os_driver/SonarArray]
* /aio [p2os_driver/AIO]
* /tf [tf/tfMessage]
* /pose [nav_msgs/Odometry]
* /dio [p2os_driver/DIO]
* /gripper_state [p2os_driver/GripperState]
* /battery_state [p2os_driver/BatteryState]
* /diagnostics [diagnostic_msgs/DiagnosticArray]
* /rosout [rosgraph_msgs/Log]
* /ptz_state [p2os_driver/PTZState]
* /motor_state [p2os_driver/MotorState]
Subscriptions:
* /ptz_control [unknown type]
* /cmd_motor_state [p2os_driver/MotorState]
* /cmd_vel [geometry_msgs/Twist]
* /gripper_control [unknown type]
Services:
* /p2os/get_loggers
* /p2os/set_logger_level
contacting node http://ros-mobile:59172/ ...
Pid: 18991
Connections:
* topic: /rosout
* to: /rosout
* direction: outbound
* transport: TCPROS
* topic: /battery_state
* to: /p3aat_gui
* direction: outbound
* transport: TCPROS
* topic: /battery_state
* to: /p2os_dashboard_21001_1347372702267
* direction: outbound
* transport: TCPROS
* topic: /tf
* to: /gmapping_node
* direction: outbound
* transport: TCPROS
* topic: /motor_state
* to: /p3aat_gui
* direction: outbound
* transport: TCPROS
* topic: /motor_state
* to: /p2os_dashboard_21001_1347372702267
* direction: outbound
* transport: TCPROS
* topic: /sonar
* to: /p3aat
* direction: outbound
* transport: TCPROS
* topic: /sonar
* to: /p3aat_gui
* direction: outbound
* transport: TCPROS
* topic: /cmd_vel
* to: http://richard-ThinkPad-X200-Tablet:38498/
* direction: inbound
* transport: TCPROS
* topic: /cmd_motor_state
* to: http://richard-ThinkPad-X200-Tablet:46926/
* direction: inbound
* transport: TCPROS
How do you instantiate the node handle?
ros::NodeHandle n("~");
orros::NodeHandle n;
Also, what's the output of
rosnode info <name of your gui node>
?i instantiate the node with ros::NodeHandle n;