ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

usamamaq's profile - activity

2023-05-29 04:11:58 -0500 received badge  Good Answer (source)
2023-05-29 04:11:58 -0500 received badge  Enlightened (source)
2022-08-01 05:38:26 -0500 received badge  Nice Answer (source)
2022-04-05 06:24:21 -0500 received badge  Self-Learner (source)
2021-06-27 02:30:49 -0500 received badge  Favorite Question (source)
2021-06-27 02:30:31 -0500 received badge  Good Question (source)
2021-06-23 06:05:54 -0500 received badge  Nice Question (source)
2021-06-23 06:05:46 -0500 received badge  Nice Answer (source)
2021-04-23 12:28:26 -0500 marked best answer Subscriber python CameraInfo and Image

Hello i am new to ros and python. Need little help in how to subscribe to CameraInfo and Image of format sensor_msgs.msg and use its data for further image processing. Here are few lines of code that i am starting with:

from sensor_msgs.msg import CameraInfo, Image
from cv_bridge import CvBridge, CvBridgeError
import cv2

if __name__ == '__main__':
   rospy.init_node('node_name')
   while ~rospy.is_shutdown():
   sub_cam_info = rospy.Subscriber('/camera/rgb/raw_camera_info', CameraInfo)
   sub_rgb = rospy.Subscriber('/camera/rgb/raw_image_color', Image)

From here i want to extract header and data information from 'sub_cam_info' and 'sub_rgb'. Something like this:

camera_info_K = sub_cam_info.K
camera_info_dist_model = sub_cam_info.distortion_model
rgb_image = CvBridge().imgmsg_to_cv2(sub_rgb, encoding="rgb8")

And then use this data for image undistortion:-

rgb_undist = cv2.undistort(rgb_img.data, camera_info_K, camera_info_dist_model)

Mainly i need help in second part i.e. extraction of parameters from CameraInfo and Image msgs. However if someone can help me to sort out body of this whole code! I am already through making up my own CameraInfo and rgb messages, using them for undistortion and publishing on ROS by but now i want to get them from another ROS module and work with them.

Thanks

2021-04-23 12:28:26 -0500 received badge  Self-Learner (source)
2021-04-23 12:28:26 -0500 received badge  Necromancer (source)
2021-03-25 06:41:41 -0500 received badge  Nice Question (source)
2020-07-18 01:23:06 -0500 received badge  Famous Question (source)
2020-04-25 09:41:12 -0500 received badge  Famous Question (source)
2020-04-16 08:00:55 -0500 received badge  Famous Question (source)
2020-04-16 08:00:55 -0500 received badge  Notable Question (source)
2020-02-05 09:23:09 -0500 received badge  Notable Question (source)
2020-02-05 09:23:09 -0500 received badge  Famous Question (source)
2019-12-10 23:55:27 -0500 received badge  Popular Question (source)
2019-12-10 23:55:27 -0500 received badge  Notable Question (source)
2019-12-10 23:55:27 -0500 received badge  Famous Question (source)
2019-11-21 14:57:24 -0500 received badge  Popular Question (source)
2019-11-21 14:57:24 -0500 received badge  Notable Question (source)
2019-11-19 06:28:25 -0500 received badge  Notable Question (source)
2019-08-30 01:39:51 -0500 received badge  Popular Question (source)
2019-08-26 03:27:25 -0500 received badge  Teacher (source)
2019-08-24 08:35:26 -0500 commented answer which best IDEs with ROS

Yes i am happy with it.

2019-08-23 11:52:55 -0500 commented question Does octomap calcNumNodes() give total number of occupied+free voxels?

So up till now what i have underatood is that everytime updatenode() is done with occupied or free cells it prune the vo

2019-08-23 11:52:43 -0500 commented question Does octomap calcNumNodes() give total number of occupied+free voxels?

So up till now what i have underatood is that everytime updatenode() is done with occupied or free cells it prune the vo

2019-08-23 07:56:57 -0500 edited question Does octomap calcNumNodes() give total number of occupied+free voxels?

Does octomap calcNumNodes() give toatal number of occupied+free voxels? Hello i am working with ros octomap library. Oct

2019-08-23 00:27:13 -0500 commented answer which best IDEs with ROS

I have extensively used PyCharm for python codes. Its a great tool. Still using it. But have not used for ROS (C++) pack

2019-08-23 00:24:50 -0500 commented question Subscribe to 2 topics and store outputs (different frequencies?)

For now your code in navdata callback is small so you can think you are publishing velocity at 200 Hz because navdata is

2019-08-22 17:42:20 -0500 answered a question which best IDEs with ROS

I started with Eclipe but got into a lot of issues in importing a ROS package and then compiling it. I switched to CLi

2019-08-22 17:42:20 -0500 received badge  Rapid Responder (source)
2019-08-22 17:33:34 -0500 commented question how to save octomap to a 2D occupancyGrid map?

octomap_server publish nav_msgs/OccupancyGrid. Link. Downprojected 2D occupancy map from the 3D map. Be sure to rema

2019-08-22 17:19:24 -0500 commented question Subscribe to 2 topics and store outputs (different frequencies?)

One more thing: Why you want to specifically get 20 msgs before updating velocity message. You want to control the ardro

2019-08-22 17:10:03 -0500 commented question Subscribe to 2 topics and store outputs (different frequencies?)

Ok if your velocity and navdata message are being published asynchronously then this can happen or can be many other rea

2019-08-22 17:09:53 -0500 commented question Subscribe to 2 topics and store outputs (different frequencies?)

Ok if your velocity and navdata message are being published asynchronously then this can happen or can be many other rea

2019-08-22 17:07:41 -0500 received badge  Commentator
2019-08-22 17:07:41 -0500 commented question Subscribe to 2 topics and store outputs (different frequencies?)

Ok if your velocity and navdata message are being published asynchronously then this can happen or can ne many other rea

2019-08-22 16:43:11 -0500 commented question Subscribe to 2 topics and store outputs (different frequencies?)

Thats how i would have done. class main_control_vel(): def __init__(self) self.velocity =Twist()

2019-08-22 16:41:38 -0500 commented question Subscribe to 2 topics and store outputs (different frequencies?)

Ok let me try step by step. Thats how i would have done. class main_control_vel(): def __init__(self) self.veloc

2019-08-22 16:40:23 -0500 commented question Subscribe to 2 topics and store outputs (different frequencies?)

Ok let me try step by step. Thats how i would have done. class def __init__(self) self.velocity =Twist() s

2019-08-22 16:39:34 -0500 commented question Subscribe to 2 topics and store outputs (different frequencies?)

I couldnt verify whole. If it solves your problem do let me know i will add this to answer. P.S. i myself was in your

2019-08-22 16:36:46 -0500 commented question Subscribe to 2 topics and store outputs (different frequencies?)

Ok let me try step by step. Thats how i would have done. main rospy.init_node('go_to', anonymous=True) m_land = main_

2019-08-22 16:35:25 -0500 commented question Subscribe to 2 topics and store outputs (different frequencies?)

Ok let me try step by step. Thats how i would have done. main 1. Init node rospy.init_node('go_to', anonymous=True)

2019-08-22 16:35:00 -0500 commented question Subscribe to 2 topics and store outputs (different frequencies?)

Ok let me try step by step. Thats how i would have done. main 1. Init node rospy.init_node('go_to', anonymous=True)