ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org
Ask Your Question
1

c++ Subscriber does not subscribe

asked 2022-01-31 10:04:19 -0600

creepyjokester33 gravatar image

Hello, I was doing the eth zurich ros course's second exercise when i got stuck. My smb_highlevel_controller node does not subscribe to the "/scan" topic. I call the nodeHandle_.subscribe function and the returned subscriber object yields "/scan" as a result of subscriber.getTopic(), but when i look at the rostopic info and rosnode info of the relevant nodes and topics, i cannot see the subsctription, let alone the callback functionality working. I also get some other errors i assume are related to the gazebo model, but i dont think they effect this issue. Below is the output i get after calling roslaunch smb_highlevel_controller smb_highlevel_controller.launch

... logging to /home/batu/.ros/log/f191615e-8297-11ec-bc07-2bc357922311/roslaunch-batu-HVY-WXX9-64214.log Checking log directory for disk usage. This may take a while. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB. started roslaunch server http://batu-HVY-WXX9:38179/ SUMMARY ======== PARAMETERS * /ekf_localization/base_link_frame: base_link * /ekf_localization/frequency: 50 * /ekf_localization/imu0: imu/data * /ekf_localization/imu0_config: [False, False, Fa... * /ekf_localization/imu0_differential: True * /ekf_localization/imu0_queue_size: 10 * /ekf_localization/imu0_remove_gravitational_acceleration: True * /ekf_localization/odom0: smb_velocity_cont... * /ekf_localization/odom0_config: [False, False, Fa... * /ekf_localization/odom0_differential: False * /ekf_localization/odom0_queue_size: 100 * /ekf_localization/odom_frame: odom * /ekf_localization/two_d_mode: True * /ekf_localization/world_frame: odom * /gazebo/enable_ros_network: True * /gazebo_ros_control/angular/z/has_acceleration_limits: True * /gazebo_ros_control/angular/z/has_velocity_limits: True * /gazebo_ros_control/angular/z/max_acceleration: 3.0 * /gazebo_ros_control/angular/z/max_velocity: 1.1 * /gazebo_ros_control/base_frame_id: base_link * /gazebo_ros_control/enable_odom_tf: False * /gazebo_ros_control/estimate_velocity_from_position: False * /gazebo_ros_control/linear/x/has_acceleration_limits: True * /gazebo_ros_control/linear/x/has_velocity_limits: True * /gazebo_ros_control/linear/x/max_acceleration: 2.0 * /gazebo_ros_control/linear/x/max_velocity: 1.1 * /gazebo_ros_control/pid_gains/LF_WHEEL_JOINT/p: 100.0 * /gazebo_ros_control/pid_gains/LH_WHEEL_JOINT/p: 100.0 * /gazebo_ros_control/pid_gains/RF_WHEEL_JOINT/p: 100.0 * /gazebo_ros_control/pid_gains/RH_WHEEL_JOINT/p: 100.0 * /gazebo_ros_control/wheel_radius_multiplier: 1.0 * /gazebo_ros_control/wheel_separation_multiplier: 1.875 * /pointcloud_to_laserscan/angle_increment: 0.0087 * /pointcloud_to_laserscan/angle_max: 1.5708 * /pointcloud_to_laserscan/angle_min: -1.5708 * /pointcloud_to_laserscan/concurrency_level: 1 * /pointcloud_to_laserscan/inf_epsilon: 1.0 * /pointcloud_to_laserscan/max_height: $(arg laser_scan_... * /pointcloud_to_laserscan/min_height: $(arg laser_scan_... * /pointcloud_to_laserscan/range_max: 50.0 * /pointcloud_to_laserscan/range_min: 0.45 * /pointcloud_to_laserscan/scan_time: 0.03333 * /pointcloud_to_laserscan/target_frame: rslidar * /pointcloud_to_laserscan/transform_tolerance: 0.01 * /pointcloud_to_laserscan/use_inf: True * /robot_description: , defaults to no clipping [ INFO] [1643639024.531005408, 0.163000000]: Velodyne laser plugin ready, 16 lasers [ INFO] [1643639024.626048317, 0.163000000]: imu plugin missing <xyzoffset>, defaults to 0s [ INFO] [1643639024.626080423, 0.163000000]: imu plugin missing <rpyoffset>, defaults to 0s [ INFO] [1643639024.654997890, 0.163000000]: Starting GazeboRosSkidSteerDrive Plugin (ns = /) [ INFO] [1643639024.675519363, 0.163000000]: Loading gazebo_ros_control plugin [ INFO] [1643639024.675632401, 0.163000000]: Starting gazebo_ros_control plugin in namespace: [ INFO] [1643639024.676196496, 0.163000000]: gazebo_ros_control plugin is waiting for model URDF in parameter [/robot_description] on the ROS param server. [ INFO] [1643639024.853401329, 0.163000000]: Loaded gazebo_ros_control. [ WARN] [1643639024.855101742, 0.165000000]: Failed to meet update rate! Took 0.16500000000000000777 [ WARN] [1643639024.857263734, 0.167000000]: Failed to meet update rate! Took 0.14700000000000001954 [ INFO] [1643639025.073200469, 0.382000000]: Controller state will be published at 50Hz. [ INFO] [1643639025.074443602, 0.383000000]: Wheel separation will be multiplied by 1. [ INFO] [1643639025.076186767, 0.385000000]: Left wheel radius will be multiplied by 1. [ INFO] [1643639025.076235800, 0.385000000]: Right wheel radius will be multiplied ...
(more)
edit retag flag offensive close merge delete

Comments

Please refrain from attaching external links. They tend to disappear over time. Also, add your source code in the above question. Remember to format code by using Ctrl + K.

skpro19 gravatar image skpro19  ( 2022-02-03 12:21:30 -0600 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2022-02-05 01:21:15 -0600

creepyjokester33 gravatar image

Fixed it, the subscriber object returned needs to be a global variable. Local doesnt work.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2022-01-31 10:04:19 -0600

Seen: 104 times

Last updated: Feb 05