[ros-users] [Discourse.ros.org] [Next Generation ROS] Failed to read 'request_type' from a header for /rostopic

Arunava Nag ros.discourse at gmail.com
Tue Sep 26 10:08:43 UTC 2017



Hello,

I tried using the ros bridge earlier with MoveIt and was able to read some joint states using moveit, by loading a PR2 model. [msg type was` std_msgs::msg::String`]

This time I wanted to read joint_states streaming from a live UR10. But experienced some weird behavior with the ros2 nodes and ros2 topic lists.

So, I subscribed to joint states from UR:

    void TestRos2::initialize(std::shared_ptr<rclcpp::node::Node>& n){
    	sub_1 = n->create_subscription<sensor_msgs::msg::JointState>("joint_state", std::bind(&TestRos2::receiveMessage, this, _1));
    }

    void TestRos2::receiveMessage(const sensor_msgs::msg::JointState::SharedPtr msg){
    	//std::cout << "Received. Interface Working: [" << msg->data << "]" << std::endl;

    	std::map<std::string, double> joint_positions;
    	for (unsigned int i = 0; i < msg->name.size(); i++) {
    		joint_positions.insert(std::make_pair(msg->name[i], msg->position[i]));
    		printf("%s \n, %lf \n", state->name[i], msg->position[i]); // **not sure if I can print it though**
    	}
    }

Next, I ros2 run the ros_bridge. After that when I did rostopic echo /joint_states (just to check if the message from UR10 was streaming), my ros_bridge window would throw this:

    Failed to read 'request_type' from a header for '/rostopic_16527_1506418563704/get_loggers'
    Failed to read 'request_type' from a header for '/rostopic_16527_1506418563704/set_logger_level'

However, I still ran my test ros2 node but nothing was at the output. Maybe my printing technique isn't right. But I tried doing `ros2 node list` but could not see my node name either. I tried running the `demo_node_cpp talker`, I would start publishing, however, `ros2 node list` or the `ros2 topic list` would not show anything.


So how do I subscribe to the joint states from ur10 and publish the same in ros2?

joint_state message sample:
    header: 
      seq: 37197
      stamp: 
        secs: 1506418567
        nsecs: 818417360
      frame_id: ''
    name: ['shoulder_pan_joint', 'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint', 'wrist_2_joint', 'wrist_3_joint']
    position: [-1.5191767851458948, -1.6008179823504847, -1.594562832509176, -1.5892565886126917, 1.4281541109085083, -0.3266199270831507]
    velocity: [0.0, 0.003975566942244768, -0.0, 0.0, 0.018676215782761574, 0.0]
    effort: [-0.0366210974752903, 2.925110101699829, 4.784023761749268, 0.4127197563648224, 0.0269165076315403, 0.01345825381577015]





---
[Visit Topic](https://discourse.ros.org/t/failed-to-read-request-type-from-a-header-for-rostopic/2759/1) or reply to this email to respond.




More information about the ros-users mailing list