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

ashwath1993's profile - activity

2022-09-14 07:34:43 -0500 received badge  Notable Question (source)
2022-09-14 07:34:43 -0500 received badge  Famous Question (source)
2022-06-10 13:56:02 -0500 received badge  Famous Question (source)
2022-05-06 18:39:50 -0500 received badge  Popular Question (source)
2022-02-25 03:56:25 -0500 marked best answer return a message type from callback

Is there a way to return anything other than void from a callback?
I want to return a message from the call back as I want to define the callback as .h so i can call it multiple times for different subscribers.
Is this possible in ros?

void chatterCallback(const std_msgs::String::ConstPtr& msg)
{
ROS_INFO("I heard: [%s]", msg->data.c_str());
}

since i can change the callback in general is a function. But where can I return the value to?

ros::Subscriber sub = n.subscribe("chatter", 1000, chatterCallback);

Since the callback is called from the subscribe. image description I have a separate callback for each of those topics, even though they carry the same message (left side carries one type and right the other). Is there a way to use a single callback function to handle both types of messages and handle all the requests at the same time?

2022-02-06 09:15:42 -0500 asked a question nodelet name appended to topic

nodelet name appended to topic Hi, I created a nodelet to read a point cloud. It is a small example taken from the node

2022-02-06 09:10:36 -0500 commented answer Automatic node shutdown if topic is no longer receiving messages

This was sufficient for what I wanted to achieve. Thanks!

2022-02-06 09:10:22 -0500 marked best answer Automatic node shutdown if topic is no longer receiving messages

Hi,

I have a node that receives camera messages. I want the node to shutdown when the rosbag is done playing. I know I can do this with roslaunch. But I wanted to know if I could do this with code.

I noticed that my code works for some recordings and fails for others.

void callback(const sensor_msgs::ImageConstPtr& msg)
{
if(sub.getNumPublishers() == 0)
{
 // run main algo and write results
 ros::shutdown();
}
else
{
   // process message
}

}

Is there a way to shutdown the node outside the callback? My subscriber is part of a class and the subscriber is initialized with the constructor.

MyClass(ros::NodeHandle& n)
{
  sub = n.subscribe<sensor_msgs::Image>("/camera/image_color", 100, &MyClass::callback, this);
}

My node is defined as follows

int main(int argc, char * argv[])
{
ros::init(argc, argv, "calib_node");

ros::NodeHandle n;
MyClass obj(n);
ros::spin();

return 0;
}
2022-02-06 09:10:00 -0500 received badge  Notable Question (source)
2022-01-04 10:50:30 -0500 received badge  Popular Question (source)
2022-01-03 15:17:45 -0500 asked a question Automatic node shutdown if topic is no longer receiving messages

Automatic node shutdown if topic is no longer receiving messages Hi, I have a node that receives camera messages. I wa

2021-09-23 07:30:02 -0500 asked a question Fusing multiple IMU inputs with ROS

Fusing multiple IMU inputs with ROS Hi, I wanted to know if there is a package that already exists that can fuse multi

2020-01-25 05:29:39 -0500 received badge  Famous Question (source)
2019-12-12 02:26:12 -0500 received badge  Famous Question (source)
2019-09-20 02:15:39 -0500 marked best answer Multiple publishers and subscribers in a class

I am trying to build single c++ file which contains a class that handles both subscribers and publishers. I want to publish multiple instance of a msg (representing different sensors) using the same class.
I wanted to know if such a system is possible on roscpp

#include <ros/ros.h>
class SubscribeAndPublish
{
 public:
SubscribeAndPublish()
{
//Topic you want to publish
pub_ = n_.advertise<ros_work::sensor>("sensors", 1000);
input();
ros::Rate loop_rate(10);
while(ros::ok())
{
pub_.publish(msg); //publishes the msg
ros::spinOnce(); //done to handle callbacks
loop_rate.sleep(); //sleep till the time is done --10
}
}
void input()
{
  int id,t;
  long int mem;
  ROS_INFO("Enter the ID: ");
  scanf("%d", &id);
  ROS_INFO("Enter the memory: ");
  scanf("%ld", &mem);
  msg.id = id;
  msg.memory = mem;
  msg.name = "test";
msg.state = true;
}

private:
ros::NodeHandle n_; 
ros::Publisher pub_;
ros_work::sensor msg;
//ros::Subscriber sub_;

};//End of class SubscribeAndPublish

int main(int argc, char **argv)
{
 //Initiate ROS
 ros::init(argc, argv, "sensors_class");

 //Create an object of class SubscribeAndPublish that will take care of everything
 SubscribeAndPublish SAPObject[4];
 ros::spin();

 return 0;
 }
2018-09-12 02:15:10 -0500 answered a question Google Cartographer TF

Cartographer uses TF2. The idea is that now the frame name should follow the new naming convention. i.e frame_id = "odo

2018-08-22 03:18:25 -0500 commented question How can I extract the coordinates of a point cloud

Rviz displays the pointcloud data if you subscribe to the topic and in the correct frame. To extract the coordinates of

2018-08-22 03:11:21 -0500 received badge  Notable Question (source)
2018-08-20 02:31:11 -0500 commented question How can I extract the coordinates of a point cloud

If you iterate over the pointcloud, you can get all the coordinates. The question needs more clarity.

2018-08-20 02:29:39 -0500 commented question roscd can't find packages

Have you tried rospack find turtlebot_teleop ? If rospack can't find it, then it must've been deleted if you did a apt-g

2018-08-08 01:26:37 -0500 marked best answer create a nodelet launch file

I have managed to build a nodelet (tegra_stereo) and it is detected when I run "rospack plugins --attrib=plugin nodelet"

 image_view /home/ashwath/catkin_ws/src/image_pipeline/image_view/nodelet_plugins.xml
 image_proc /home/ashwath/catkin_ws/src/image_pipeline/image_proc/nodelet_plugins.xml
 image_rotate /home/ashwath/catkin_ws/src/image_pipeline/image_rotate/nodelet_plugins.xml
 image_publisher /home/ashwath/catkin_ws/src/image_pipeline/image_publisher/nodelet_plugins.xml
 stereo_image_proc /home/ashwath/catkin_ws/src/image_pipeline/stereo_image_proc/nodelet_plugins.xml
 depth_image_proc /home/ashwath/catkin_ws/src/image_pipeline/depth_image_proc/nodelet_plugins.xml
 tegra_stereo /home/ashwath/catkin_ws/src/tegra_stereo/nodelet_plugins.xml
 pointgrey_camera_driver/home/ashwath/catkin_ws/src/pointgrey_camera_driver/pointgrey_camera_driver/nodelet_plugins.xml

I want to run the nodelet. I couldn't find any helpful tutorial to do that. How do I start the nodelet? Or how to call the nodelet on another ros program?

Update 2 I could launch the nodelet using the following launch file.

<launch>
<node pkg="nodelet" type="nodelet" name="standalone_nodelet"  args="manager"/>
<node pkg="nodelet" type="nodelet" name="tegra" args="load tegra_stereo/tegra_stereo_proc 
standalone_nodelet" output="screen">
 </node>          
</launch>

This is what I get on rqt_graph standalone_nodelet doesn't connect to tegra_stereo standalone_nodelet doesn't connect to tegra_stereo

This is on my rostopic list

/clock
/kitti_stereo/left/camera_info 
/kitti_stereo/left/image_rect
/kitti_stereo/right/camera_info
/kitti_stereo/right/image_rect
/rosout
/rosout_agg
/standalone_nodelet/bond
/statistics
/stereo/cam0/image_rect
/stereo/cam0/image_rect/compressed
/stereo/cam0/image_rect/compressed/parameter_descriptions
/stereo/cam0/image_rect/compressed/parameter_updates
/stereo/cam0/image_rect/compressedDepth
/stereo/cam0/image_rect/compressedDepth/parameter_descriptions
/stereo/cam0/image_rect/compressedDepth/parameter_updates
/stereo/cam0/image_rect/theora
/stereo/cam0/image_rect/theora/parameter_descriptions
/stereo/cam0/image_rect/theora/parameter_updates
/stereo/cam1/image_rect
/stereo/cam1/image_rect/compressed
/stereo/cam1/image_rect/compressed/parameter_descriptions

/stereo/cam1/image_rect/compressed/parameter_updates /stereo/cam1/image_rect/compressedDepth /stereo/cam1/image_rect/compressedDepth/parameter_descriptions /stereo/cam1/image_rect/compressedDepth/parameter_updates /stereo/cam1/image_rect/theora /stereo/cam1/image_rect/theora/parameter_descriptions /stereo/cam1/image_rect/theora/parameter_updates /stereo/disparity /stereo/disparity_raw /stereo/disparity_raw/compressed /stereo/disparity_raw/compressed/parameter_descriptions /stereo/disparity_raw/compressed/parameter_updates /stereo/disparity_raw/compressedDepth /stereo/disparity_raw/compressedDepth/parameter_descriptions /stereo/disparity_raw/compressedDepth/parameter_updates /stereo/disparity_raw/theora /stereo/disparity_raw/theora/parameter_descriptions /stereo/disparity_raw/theora/parameter_updates /tf

The nodelet subscribes to the following topics but it does not work for me. There are no messages on the /stereo topics. Any insights on doing this? Thanks!

2018-07-11 10:55:23 -0500 received badge  Teacher (source)
2018-07-11 05:28:49 -0500 commented question Subscribing to a topic whenever it publishes without affecting the execution of program

If the second node doesn't have any data from the first node, what work can it do? In any case, you can place the task

2018-07-11 01:49:50 -0500 answered a question Can 3D Lidar localize when placed vertically ?

In general, for ICP to work well you will need to have planar regions that can be detected. If you have irregular surfac

2018-07-11 01:36:30 -0500 answered a question How can I remove lidar ring?

You have to do a ground plane detection. There are several approaches using PCL like planar segmentation. Just filteri

2018-07-09 09:15:45 -0500 answered a question The axis of VLP 16 PUCK changes each time.

Have you tried the velodyne driver? It works perfectly with the VLP 16 series. A screenshot of the problem can be more

2018-07-09 09:08:23 -0500 answered a question Learn ros doing exercices

The tutorials on the ROS website are a great way to start. Once you complete that, you can do the husky demo as suggeste

2018-07-09 08:24:15 -0500 answered a question what is the differences between ego-motion and odometry

Both words can be used interchangeably in general. Ego-motion is defined as the 3D motion of a system (ex camera) with

2018-07-09 08:17:43 -0500 answered a question Is it more "rossy" to publish to one topic and later distinguish msgs?

ROS logging uses approach 1. All log messages are passed to /rosout. The first approach is simple to implement as well

2018-06-26 03:35:18 -0500 received badge  Student (source)
2018-05-31 01:27:46 -0500 received badge  Notable Question (source)
2018-05-28 07:58:47 -0500 received badge  Popular Question (source)
2018-05-28 06:57:16 -0500 commented answer shutdown alll nodes

Thanks a lot! I didn't know of this parameter.

2018-05-28 06:56:48 -0500 marked best answer shutdown alll nodes

Hi,

I want to shutdown all nodes from within a ros node. ros::shutdown() kills the current node but does not kill the other nodes.

I know that all nodes can be killed using the terminal and through the launch file. But I test if a certain condition is met and only in such a circumstance I want all the nodes to shutdown.

Thanks!

2018-05-28 06:32:07 -0500 commented answer shutdown alll nodes

Hi, the rosnode.kill_nodes and the API is for the python variant. I am not able to find the C++ equivalent.

2018-05-28 06:21:00 -0500 asked a question shutdown alll nodes

shutdown alll nodes Hi, I want to shutdown all nodes from within a ros node. ros::shutdown() kills the current node but

2018-01-14 20:29:35 -0500 marked best answer Start a nodelet roscpp (Tegra SGM nodelet)

I have a ros package which builds a image_proc like node for cuda SGM.
I have built the package and the nodelet is built. I am not sure how to run it. I have looked through the ros tutorials but there isn't a clear explanation of how to run a nodelet for a generic case.

The nodelet is exported as follows

#include <pluginlib/class_list_macros.h>
PLUGINLIB_EXPORT_CLASS(tegra_stereo::TegraStereoProc, nodelet::Nodelet)

After this, how do call this nodelet? Since I do not have a cpp file like the image_proc or stereo_image_proc to directly call the method. Is there a way to launch the nodelet or how do I launch it?

Thanks!

2018-01-14 20:28:45 -0500 received badge  Notable Question (source)
2018-01-14 20:28:45 -0500 received badge  Famous Question (source)
2018-01-04 04:14:10 -0500 received badge  Famous Question (source)
2018-01-04 04:14:10 -0500 received badge  Notable Question (source)
2017-12-08 05:07:12 -0500 commented answer Using CallbackQueue

Where do I call the callAvailable() if I have the nodehandle in a class?

2017-11-08 07:57:24 -0500 received badge  Famous Question (source)
2017-10-23 23:53:53 -0500 received badge  Famous Question (source)