Robotics StackExchange | Archived questions

Rosjava + depth from kinect

Hi,

I need get Z-coordinate from kinect. I know that one way is get this information from topic depth/image ... where is compute Z-coordinate ... or another way is that compute from depth points. But I can't get right data from topics by rosjava. I write subscriber ->

  Subscriber<sensor_msgs.Image> depthPoints = connectedNode.newSubscriber("/cam3d/depth/image", sensor_msgs.Image._TYPE);
    depthPoints.addMessageListener(new MessageListener<sensor_msgs.Image>() {
         @Override
          public void onNewMessage(sensor_msgs.Image message) {
             ChannelBuffer data = message.getData();
             int heightM = message.getHeight();
             int widthM  = message.getWidth();
             for(int x = 0; x < widthM; x++) {
                 for(int y = 0; y < heightM ; y++) { System.out.println(data.readUnsignedShort());
                 }
             }
          }
        });

but I see in cmd wrong number, so I don't know what I doing wrong ...

So, How I can get Z-coordinate by rosjava ?

Thank's for any advice

Asked by LeopoldPodmolík on 2013-03-31 10:08:52 UTC

Comments

Maybe it's an endianness issue?

Asked by damonkohler on 2013-05-07 20:57:42 UTC

Answers