Ask Your Question

mrshifo's profile - activity

2017-07-28 07:22:39 -0600 received badge  Famous Question (source)
2017-07-28 07:22:39 -0600 received badge  Notable Question (source)
2017-07-28 07:22:39 -0600 received badge  Popular Question (source)
2015-01-26 03:06:24 -0600 received badge  Famous Question (source)
2014-06-22 09:57:31 -0600 received badge  Famous Question (source)
2014-06-19 11:24:52 -0600 received badge  Taxonomist
2014-05-15 07:13:48 -0600 received badge  Notable Question (source)
2014-05-15 05:24:34 -0600 received badge  Popular Question (source)
2014-05-15 03:07:39 -0600 asked a question How contact directly people on ROS ?

Hi to all,

you may be able to contact a person registered on this portal ?

Thanks

2014-05-07 11:43:10 -0600 received badge  Notable Question (source)
2014-05-06 00:23:27 -0600 received badge  Popular Question (source)
2014-05-05 06:13:25 -0600 asked a question Thread Subscriber and Publisher in the same class ?

I would like to have a class that manages threads. Each Thread subscribe and public at different frequencies.

Error:

Description Resource    Path    Location    Type
no match for call to ‘(boost::_mfi::mf1<void, b, const boost::shared_ptr<const std_msgs::String_<std::allocator<void> > >&>) (const boost::shared_ptr<const std_msgs::String_<std::allocator<void> > >&)’   test        line 225, external location: /usr/include/boost/function/function_template.hpp  C/C++ Problem

Code:

#include "ros/ros.h"
#include "ros/callback_queue.h"
#include "std_msgs/String.h"

#include "ros/network.h"

#include <boost/thread.hpp>


class b
{
public:
    b();
    ros::CallbackQueue g_queue;
    ros::NodeHandle n;
    ros::SubscribeOptions ops;
    ros::Subscriber sub;
    void chatterCallbackMainQueue(const std_msgs::String::ConstPtr& msg);
    void chatterCallbackCustomQueue(const std_msgs::String::ConstPtr& msg);
    void callbackThread();

};

void b::chatterCallbackMainQueue(const std_msgs::String::ConstPtr& msg)
{
  ROS_INFO_STREAM("I heard: [ " << msg->data << "] in thread [" << boost::this_thread::get_id() << "] (Main thread)");
  static double t1 = ros::Time::now().toSec();
  double t2 = ros::Time::now().toSec();
  ROS_INFO("Freq to call main: %f",1/(t2-t1));
}

void b::chatterCallbackCustomQueue(const std_msgs::String::ConstPtr& msg)
{
  ROS_INFO_STREAM("I heard: [ " << msg->data << "] in thread [" << boost::this_thread::get_id() << "]");
  static double t1 = ros::Time::now().toSec();
  double t2 = ros::Time::now().toSec();
  ROS_INFO("Freq to call custom: %f",1/(t2-t1));
  t1 = t2;

}

void b::callbackThread()
{
  ROS_INFO_STREAM("Callback thread id=" << boost::this_thread::get_id());

  double tim1;
  double tim2;

  ros::NodeHandle n2;
  while (n2.ok())
  { tim1 = ros::Time::now().toSec();
    g_queue.callAvailable(ros::WallDuration(0.01));
    tim2 = ros::Time::now().toSec();
    ROS_INFO("thread freq: %f",1/(tim2-tim1));

  }


}

b::b()
{
    ops = ros::SubscribeOptions::create<std_msgs::String>("chatter", 1000,&b::chatterCallbackCustomQueue,ros::VoidPtr(), &g_queue);
    sub = n.subscribe(ops);

    //ros::Subscriber sub2 = n.subscribe("chatter", 1000, chatterCallbackMainQueue);

    boost::thread chatter_thread(boost::bind(&b::callbackThread, this));

    //ROS_INFO_STREAM("Main thread id=" << boost::this_thread::get_id());


    double t1;
    double t2;

    ros::Rate r(1);
    while (n.ok())
    {
      t1 = ros::Time::now().toSec();
      ros::spinOnce();
      r.sleep();
      t2 = ros::Time::now().toSec();
      ROS_INFO("main loop Hz: %f",1/(t2-t1));
    }


  chatter_thread.join();
}


int main(int argc, char **argv)
{
  ros::init(argc, argv, "listener_with_custom_callback_processing");

  b obj;

  return 0;
}
2014-04-24 01:36:01 -0600 commented question Information obstacles divergent Why ?
2014-04-23 01:04:15 -0600 received badge  Enthusiast
2014-04-22 02:49:47 -0600 answered a question Electric ROS installation giving 404 error on OSX.

Hello, I had similar problems, I solved using a virtual machine on which I installed ubuntu. I hope I was signing for help. greetings

2014-04-22 02:00:54 -0600 commented question Electric ROS installation giving 404 error on OSX.

can you post the link of the instructions.

2014-04-22 00:15:11 -0600 commented question Information obstacles divergent Why ?
2014-04-22 00:14:22 -0600 asked a question Information obstacles divergent Why ?

HI to all,

I am new with ROS. I could ask you some questions about Navigation Stack in particular how it is possible to record obstacles.

I would like to keep track of the obstacles for a mobile robot and to know the distance of the obstacles with respect to a frame fixed to the robot (base_link).

I attach the configuration files.

As you can see from the picture, after just two seconds that I surf with the robot in the environment I noticed that the position of obstacles tends to diverge more and more I do not understand why.

Could you kindly help me?

Best Regards

2014-04-11 07:00:35 -0600 received badge  Famous Question (source)
2014-04-10 12:12:09 -0600 commented question How Extract Obstacle Information ?

Right !! Thank you very much, return the correct value. But I have noticed that sometimes the information remain obstacles in the map. I attach photos and configuration files. I do not understand why. https://www.dropbox.com/s/4bxzlid7e25mwuu/obstacle_remain.png https://www.dropbox.com/s/4bxzlid7e25mwuu/obstacle_remain.png https://www.dropbox.com/s/eu7xq4nzpbdrjeb/base_laser.png https://www.dropbox.com/s/ygvetcp7j2yspuu/config.txt thanks

2014-04-09 12:58:57 -0600 commented question How Extract Obstacle Information ?

Thank you very much, but why ROS_INFO("size: [%f]", msg->cells.size()); return size = 0.05000 when there are obstacles ? the msg->cells.size() should return the number of cells occupied by obstacles but it did not happen.

2014-04-09 08:24:10 -0600 received badge  Notable Question (source)
2014-04-09 04:31:38 -0600 commented question How Extract Obstacle Information ?

Yes but msg->cells.size() don't return the dimension of the array !! So how can I know the last index of the array cells[] ? ( https://www.dropbox.com/s/0e61wd46v4201jg/screen.png )

2014-04-09 01:00:38 -0600 received badge  Popular Question (source)
2014-04-09 00:25:43 -0600 received badge  Editor (source)
2014-04-09 00:24:43 -0600 commented question How Extract Obstacle Information ?

This is my code for read where are the obstacles: #include "ros/ros.h" #include "nav_msgs/GridCells.h" void chatterCallback(const nav_msgs::GridCells::ConstPtr& msg) { ROS_INFO("width: [%f]", msg->cell_width); ROS_INFO("height: [%f]", msg->cell_height); ROS_INFO("size: [%f]", msg->cells.size()); ROS_INFO("pos_x: [%f]", msg->cells[0].x); // segmentation fault if there are not obstacle's ROS_INFO("pos_y: [%f]", msg->cells[0].y); ROS_INFO("pos_z: [%f]", msg->cells[0].z); } int main(int argc, char **argv) { ros::init(argc, argv, "listener"); ros::NodeHandle n; ros::Subscriber sub = n.subscribe("/move_base_node/local_costmap/obstacles", 1000, chatterCallback); ros::spin(); return 0; } ---------------------------------------------------------------- The Problem is: if there are not obstacles: - return segmentation fault - width = 0.05 height =0.05 size =0.0000 how can I know the size of the array cells[] ? I would like to know if there are obstacles and where

2014-04-07 23:51:24 -0600 asked a question How Extract Obstacle Information ?

Hi everybody,

I configured my non static map, but I have not figured out how to read information on obstacles. The type of topic (/move_base_node/local_costmap/obstacles) is nav_msgs::GridCells ?

I could use occupancy grid ?

thanks

#Independent settings for the planner's costmap
global_costmap:
    publish_voxel_map: true
    global_frame: odom
    robot_base_frame: base_footprint
    update_frequency: 2.5
    publish_frequency: 1.0
    static_map: false
    rolling_window: true
    width: 20.0
    height: 20.0
    resolution: 0.05
    origin_x: 0.0
    origin_y: 0.0

#Independent settings for the local costmap
local_costmap:
    publish_voxel_map: true
    global_frame: odom
    robot_base_frame: base_footprint
    update_frequency: 5.0
    publish_frequency: 2.0
    static_map: false
    rolling_window: true
    width: 10.0
    height: 10.0
    resolution: 0.05
    origin_x: 0.0
    origin_y: 0.0
map_type: costmap
transform_tolerance: 0.2
obstacle_range: 2.5
raytrace_range: 3.0
inflation_radius: 0.25

observation_sources: base_scan

#base_scan_marking: {sensor_frame: base_scan_link,
#                    data_type: PointCloud2,
#                    topic: /base_scan/marking,
#                    expected_update_rate: 0.2,
#                    observation_persistence: 0.0,
#                    marking: true,
#                    clearing: false,
#                    min_obstacle_height: 0.06,
#                    max_obstacle_height: 2.0}

base_scan: {sensor_frame: base_laser_front_link,
            data_type: LaserScan,
            topic: /base_scan,
            expected_update_rate: 0.2,
            observation_persistence: 0.0,
            marking: true,
            clearing: true,
            min_obstacle_height: -0.10,
            max_obstacle_height: 2.0}

#change this
footprint: [[0.26, 0.18],
            [0.26, 0.014],
            [0.31, 0.014],
            [0.31, -0.014],
            [0.26, -0.014],
            [0.26, -0.18],
            [-0.27, -0.18],
            [-0.27, 0.18]]

controller_frequency: 10.0
controller_patience: 15.0
clearing_radius: 0.25
footprint_padding: 0.03