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

Erwan R.'s profile - activity

2020-12-16 12:59:22 -0500 received badge  Nice Question (source)
2020-12-16 12:59:18 -0500 marked best answer How to link to third party library ?

Hello

I'm still working on the communication between ROS electric and Promethe Neural Network simulator and I'm trying to rosmake a node that includes Promethe C functions. I'm using the following CMakeLists.txt :

I can rosmake witjout error but I get :

[rosmake-0] Finished <<< promROS_connector [SKIP] No rule to make target None

And no executable in bin/ . I would know if my CMakeLists is correct and what I exactly have to use to compile with third party C compiled libraries. The ~/simulateur is in ROS_PACKAGE_PATH.

Thanks for reading and answering.

cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

# Set the build type.  Options are:
#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
#  Debug          : w/ debug symbols, w/o optimization
#  Release        : w/o debug symbols, w/ optimization
#  RelWithDebInfo : w/ debug symbols, w/ optimization
#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE RelWithDebInfo)

rosbuild_init()

#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

#uncomment if you have defined messages
rosbuild_genmsg()
#uncomment if you have defined services
#rosbuild_gensrv()

#common commands for building c++ executables and libraries

#****************** INCLUDES **************************

include_directories(~/simulateur/prom_user/include)

include_directories(~/simulateur/libcomm/include)
include_directories(~/simulateur/libcomm/include/protocol/virtual)

include_directories(~/simulateur/prom_tools/include)
include_directories(~/simulateur/prom_kernel/include)
include_directories(~/simulateur/shared/include)

#*******************************************************

link_directories(~/simulateur/lib/Linux/comm)
rosbuild_add_executable(prom2ROS src/prom_to_ROS.cpp)
target_link_libraries(prom2ROS ~/simulateur/lib/Linux/comm/libcomm_debug)

EDIT :

After using :

 target_link_libraries(prom2ROS libcomm_debug)

the error is :

   Linking CXX executable ../bin/prom2ROS
   /usr/bin/ld: cannot find -llibcomm_debug
   collect2: ld returned 1 exit status

Does I have to set the LD_LIBRARY_PATH to allow ld to find the libcomm_debug (it is now empty - libcomm_debug is a .a static library) ?

2020-07-18 10:36:38 -0500 received badge  Notable Question (source)
2020-04-21 03:54:22 -0500 marked best answer ROS, Robot Architecture and Complex task planning

Hello,

I'm currently reading a lot on Robot Control Architectures (from classical Sense-Plan-Act, Brook's Subsumption to Layered Hybrid Architectures - CLARAty, Atlantis, heterogeneous LAAS architecture, etc. and UTC ACT-R, SOAR) and I have two related questions.

1/ First, I'm wondering where and/or how ROS would integrate in these architectures principles. On one hand, some people quote it as a component-based framework providing functionalities. In a 3-Layer architecture, it would be the Functional Layer, that implements low-level drivers and controllers, essentials algorithms (SLAM, Motion Control). But on the other hand, ROS also contains/provides planning, decision-making algorithms, that can be seen as Deliberative Layer capabilities (Motion and Path planning are example for "low-level" planning, but as "planning", I would qualify them as Deliberative). Is ROS only a framework that provide functionalities, or does it allows to control the usage of these functionalities ?

2 / This leads to my second question : if ROS (would theoretically) allows for functionality control, are there existing packages/stacks (I'm still working with fuerte) that allow this control ? Something like a task planner, that would be able to take a goal and find the relevant sequence of sub-goals to be accomplished and the corresponding functionalities (nodes ?) that must be called for that ? Or does this high-level planning need a meta-framework able to launch and shutdown the relevant functionalities ? Is ROS designed for that ?

I don't think this (these) question(s) as only technical and to have a definitive answer but more philosophical and that's why opinions from main ROS team and/or roboticists / AI experts are welcome. I posted this question here as there are many experts that already probably thought about it. If this question is not relevant with the intented goal of ros.org, please tell me where it could be more adapted to post.

Thanks for reading and waiting for your point of view.

2018-09-18 20:52:28 -0500 received badge  Good Answer (source)
2018-09-18 20:52:26 -0500 received badge  Good Question (source)
2018-04-20 13:48:09 -0500 received badge  Stellar Question (source)
2017-11-29 06:29:20 -0500 marked best answer Subscribing to topic throw compilation error

Hi ROS users !

I'm trying to write a simple controller that takes LaserScan and directly send motor command (in Braitenberg's style), but I'm quite struggling with subscription to node. The subscription method is not recognized when rosmaking and I don't understand what's wrong as I think I doing that the same way as in Writing a Publisher and Subscriber or Publishers and Subscribers.

Any hint would be welcome !

Here is the code :


Class definition

 #ifndef BRAITENBERG_CONTROLLER_H
 #define BRAITENBERG_CONTROLLER_H

 #include <iostream>
 #include <ros/ros.h>

 #include <geometry_msgs/Twist.h>

 #include <tf/transform_listener.h>
 #include <tf/message_filter.h>
 #include <message_filters/subscriber.h>

 #include <laser_geometry/laser_geometry.h>
 #include <sensor_msgs/LaserScan.h>

 namespace braitcontrol {

  class BrController
  {
     private :
        //! The node handle we'll be using
        ros::NodeHandle nh_;
        //! publishing to "/base_controller/command" topic
        ros::Publisher cmd_vel_pub_;
        ros::Subscriber scan_filter_sub_;

         //message_filters::Subscriber<sensor_msgs::LaserScan> scan_filter_sub_;

        tf::MessageFilter<sensor_msgs::LaserScan> * tf_filter_; 
        tf::TransformListener tf_;

        std::string target_frame_;

     public :
        BrController(ros::NodeHandle &nh);

        bool driveBraitenberg();
        sensor_msgs::LaserScan>& laser_ptr);
        void msgCallback(const sensor_msgs::LaserScan & msg);

    };

}

#endif

Class Implementation

#include "braitenberg_controller.h"

using namespace braitcontrol;

BrController::BrController(ros::NodeHandle &nh) : target_frame_("/base_controller/command")
{
   /* Node handle that manage the node and provide publishing and subscribing function */
   nh_ = nh;

   /* Set up the publisher for the cmd_vel topic : we'll publish on this topic to drive the robot */
   cmd_vel_pub_ = nh_.advertise<geometry_msgs::Twist>("/base_controller/command", 1);

   /* Same for subscriber */
   scan_filter_sub_ = nh_.subscribe("scan", 50, msgCallback); // Faulty line !!!
   //tf_filter_ = new tf::MessageFilter<sensor_msgs::LaserScan>(scan_filter_sub_, tf_, target_frame_, 10);    
}

 void BrController::msgCallback(const sensor_msgs::LaserScan & msg)
 {
    std::cout << "Callback" << std::endl;
 }

 bool BrController::driveBraitenberg()
 {
    // Just driving robot according a constant rotation command
    //we are sending commands of type "twist" to drive the robot
    geometry_msgs::Twist base_cmd;


float cmd = 50.0;

    while(nh_.ok())
    {       
     base_cmd.angular.z = cmd;
         //publish the assembled command
         cmd_vel_pub_.publish(base_cmd);
    }

  return true;
}

int main(int argc, char** argv)
{
  //init the ROS node
  ros::init(argc, argv, "braitenberg_controller");
  ros::NodeHandle nh;

  BrController bControl(nh);
  bControl.driveBraitenberg();

  return 0;
}

And here is the error :

  [100%] Building CXX object CMakeFiles/pr2_braitenberg_controller.dir/src/braitenberg_controller.o
/home/renaudo/ros_workspace/pr2_braitenberg_controller/src/braitenberg_controller.cpp:
    In constructor ‘braitcontrol::BrController::BrController(ros::NodeHandle&)’:
/home/renaudo/ros_workspace/pr2_braitenberg_controller/src/braitenberg_controller.cpp:13: error:
    no matching function for call to ‘ros::NodeHandle::subscribe(const char [5], int, <unresolved overloaded function type>)’
/opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp/include/ros/node_handle.h:785: note:
    candidates are: ros::Subscriber   ros::NodeHandle::subscribe(ros::SubscribeOptions&)
2017-07-13 21:49:02 -0500 received badge  Nice Question (source)
2016-12-21 10:52:33 -0500 commented answer ROS MultiThreading example

Well, from quick digging into that old code, it appears that the Queues are not used at all. There is only one service provided by nhSrv and callbacks on nhCall. However the node is not used anymore, so don't rely too much on that example. It may not be up-to-date with latest distro (2 y old).

2016-11-13 14:19:38 -0500 marked best answer Gazebo real and simulation time

Hello,

As running gazebo, I noticed the lower toolbar with RMS Error, xReal Time, Real time, etc. I'm wondering how exactly are computed all this times and why, when I'm roslaunching lots of nodes, xReal Time is decreasing (as the simulator is slower and the computer also) ?

If I missed some doc about that, please link.

2016-08-05 07:51:30 -0500 received badge  Famous Question (source)
2016-05-14 07:17:29 -0500 received badge  Popular Question (source)
2016-05-12 05:03:52 -0500 asked a question Turtlebot kinect sees inconsistent black area

Hello all !

Taking a look today to image sent by kinect of our turtlebot, we noticed a black area on the right of the depth image, that sometimes disappears, but appears in situations where it shouldn't. We made the hypothesis that it could be the rod supporting the platform but as it disappears, that hypothesis isn't satisfying. Does someone else experienced such thing ?

Pictures :

Top left, Bottom left : Depth and camera images from the kinect ; Right : Top view of the robot in its (mapped) environment. The red line is the scan deduced from the kinect depth image (pointcloud_to_laserscan).

image description

image description

2016-01-09 02:02:42 -0500 received badge  Nice Answer (source)
2015-11-13 04:04:43 -0500 received badge  Famous Question (source)
2015-11-13 04:04:43 -0500 received badge  Notable Question (source)
2015-11-02 01:43:11 -0500 marked best answer Publish a Clock - time stuff in ROS

Hello ROS community !

I have question about Time in ROS (I'm in Fuerte on Ubuntu 12.04). Let me explain the situation : I have a basic simulator written with ROS, that receive an /action topic, publish a /perception topic, with the relevant custom messages. On the other hand, I have two nodes, a Perceptive one, that transform perception into state, and a Controller that use state and compute an action, that is sent to the simulator. The connection is :

Simulator -> /perceptiontopic -> (Percept -> /state -> Controller) -> /action -> Simulator

All my nodes are firing Timers at a certain NODERATE that trigger (or not):

  • world update for the Simulator : if the relevant time in second has gone, the world changes. The world change is independent from the NODERATE itself has the world evolution has its own "dynamic".

  • Perception update and State publishing for the perceptive node : if we received a /perception message or some time in second has gone, we publish a /state message. The involved durations are also independent from NODERATE.

  • Action computation for the Controller. When it receives a /state message, it computes the action message and publish it to the simulator.

I'm wondering about the time consistency as my simulator doesn't publish a /clock topic (nor my others nodes subscribe to /clock). I had the same NODERATE for the simulator and others nodes and a certain behavior. I changed the Perceptive and Controller nodes' NODERATE (lower than simulation one) and now the behaviour is different. In my understanding, it shouldn't as the time aspects of my nodes are supposed to be independent.

So :

  • Is it necessary to have a /clock (from the simulator) to ensure time consistency between nodes that commuicate together ?

  • If so, what time should my simulator publish ? A ros::Time::now() (+/use_sim_time setup) ? How my perceptive and control nodes handle that ? Should they explicitly subscribe to /clock and have a callback on that ? What's the difference with my ros::Timer ?

  • I understand that no realtime is guaranteed with such tools, but what is the range of frequency / period ROS can handle without risk of inconsistency ?

Thanks for reading, Erwan

2015-11-01 06:58:09 -0500 marked best answer Callback function seems to be never called

Hi again,

This question follows this one.

Now my node is compiling and executing, but it seems that the callback function is never called on the subscription to lasers. /scan is remapped to /base_scan (that send data, according to rostopic echo /base_scan ). As far as I understand, every time the node gets a message, it should trigger the callback and I should get a console output, a rxconsole output and the robot should move a little. I don't get what can fail in this case.

What's wrong with the code or what should be done to be sure that the node really gets the data ?

Sources :

  BrController::BrController(ros::NodeHandle &nh) : target_frame_("/base_controller/command")
 {
/* Node handle that manage the node and provide publishing and subscribing function */
nh_ = nh;

/* Set up the publisher for the cmd_vel topic : we'll publish on this topic to drive the robot */
 cmd_vel_pub_ = nh_.advertise<geometry_msgs::Twist>("/base_controller/command", 1);

scan_filter_sub_ = nh_.subscribe("scan", 50, &BrController::msgCallback, this);
 }

void BrController::msgCallback(const sensor_msgs::LaserScan & msg)
{
    geometry_msgs::Twist base_cmd;

    std::cout << "Callback" << std::endl;
    ROS_INFO("Callback");

   base_cmd.angular.z = 50;
   cmd_vel_pub_.publish(base_cmd);

   std::cout << "published command : [" << base_cmd.linear.x << " " << base_cmd.linear.y << " " <<  base_cmd.linear.z << "][" << base_cmd.angular.x << " " << base_cmd.angular.y << " " << base_cmd.angular.z << "]"<< std::endl; 
}


bool BrController::driveBraitenberg()
{
  //we are sending commands of type "twist" to drive the robot
  geometry_msgs::Twist base_cmd;

  while(nh_.ok())
  {
     // Nothing is done as we want the robot to be driven from the laser input  
   }

  return true;
}
2015-10-05 10:28:27 -0500 received badge  Famous Question (source)
2015-10-05 05:46:13 -0500 received badge  Notable Question (source)
2015-08-11 11:56:31 -0500 received badge  Famous Question (source)
2015-08-05 09:45:41 -0500 commented question How implement a multi-threaded ROS node with callbacks not being subscribers?

Why can't you loop on your TCP listening and publish at the condition that there is new data or that enough time has elapsed ? You just need a publisher that will be invoked potentially as fast as the TCP listener or at a lower rate depending on the condition set.

2015-07-10 09:47:27 -0500 marked best answer ROS MultiThreading example

Hello,

I'm currently working on a node that provides a service to other nodes but I noticed that being a server blocks the execution of the node until a Request. As my node needs to handle some callbacks, I read that a solution could be multithreading, and several good explanations on what's behind the hood, but I have trouble understanding how to use it.

My case is the following : the nodes receives sensory information and publish a motor command. In most of the case, this is enough, but in certain conditions, another node will send a request for stopping. I thought a service would fit better than a topic, as it allows the requesting node to wait for the response before continuing.

From my readings, I understand that I can declare a MultithreadSpinner or an AsyncSpinner, the second being non blocking. How does that changes my usual node organisation (C++ pseudo code) :

int main()
{
     ros::init(...);
     ros::NodeHandle nh;
     MyClassController controller(nh, ...);
     controller.run();
}

MyClassController::run()
{
    while(nh_.oh())
    {
        // Process Callbacks
         ros::spinOnce()
    }
}

MyClassController::callback1(ros::Datatype msg){ myClassAttribute = msg }
MyClassController::myService(mypackage::mypackageserv req, mypackage::mypackageserv res){}
(...)

Would it be something like :

int main()
{
     ros::init(...);
     ros::NodeHandle nh;
     MyClassController controller(nh, ...);
     controller.run();
}

MyClassController::run()
{
    // Process Callbacks
    myclassAsyncSpinner.start();
    myclassAsyncSpinner.waitForShutdown();
}

MyClassController::callback1(ros::Datatype msg){ myClassAttribute = msg }
MyClassController::myService(mypackage::mypackageserv req, mypackage::mypackageserv res){}
(...)

In this case, how can I be sure the service will be processed separately from other callbacks thus not block them? I feel that I may be mixing multi threading and "multi callback queuing", and the second is more relevant to my problem.

To sum things up : could you show me or point me to MWE (Minimal Working Example) of nodes that use Muilti-threading (let's say with AsyncSpinner) and (at least) two Callback queues, or more specifically, a MWE of a node that provide a service and process callback in parallel ?

Thanks for reading,

EDIT : From reading again the Different Queues explanations, I think I get it a bit better : should I declare 2 node handles in myClassController, with their queues, and then subscribe / advertise explicitly my service to one and my callbacks to the other ? Do I also need a multithread spinner and pass them the specific queue ?

2015-07-10 09:47:27 -0500 received badge  Self-Learner (source)
2015-07-10 09:47:27 -0500 received badge  Necromancer (source)
2015-06-04 09:14:08 -0500 received badge  Famous Question (source)
2015-05-20 10:23:30 -0500 received badge  Notable Question (source)
2015-05-20 07:34:15 -0500 commented answer Using map for pose estimation

Thanks for answering ! To my experience, AMCL and gmapping aren't incompatible, and AMCL requires a map, so a good way to provide this is from gmapping and the poses estimates from both methods aren't writing on the same topic. I didn't use normalize, I'm gonna give it a try.

2015-05-20 04:38:22 -0500 received badge  Popular Question (source)
2015-05-19 06:47:41 -0500 answered a question LocalPathPlanner PoseStamped

You can call the size() method on pathConstPtr->poses : arrays in messages are mainly handled as std::vector from cpp.

2015-05-19 03:41:58 -0500 asked a question Using map for pose estimation

Hello,

Quite a newbie question, but I can't understand the right way to do things properly. (I'm using groovy under Ubuntu 12.04).

I want to get a position and orientation estimations of my PR2 robot (simulated or real) in my node.

I have gmapping running that builds me a map and publish a transform between the frame odom_combined and map. On the other hand, I subscribed to the /robot_pose_ekf/odom_combined topic and I get frequent odometry pose estimations. I understand that I could use AMCL for localisation (which provides the amcl_pose topic) but to keep my architecture simple, I just want to use gmapping. I don't use only the odom estimation because of its drift over time.

I also "lookup for transform" between odom and map :

(...)
try
{
    nhCall_.getParam("gmapping_node/odom_frame", frameToTransform);
    listener.lookupTransform("/map", frameToTransform, ros::Time(0), transform_base);
}
(...)

But how do I use the transform (transform_base) as a pose estimation ? As it is a StampedTransform, I can't directly set it as my pose. When trying to set, field by field the Pose message with the transform data, I end up with the following warning :

[ WARN] [1432023038.082861765, 6687.377000000]: MSG to TF: Quaternion Not Properly Normalized

and I'm not sure normalizing it by hand is the best solution (the warning still appears when rotating). So can someone explain me the right way to use a transform for pose estimation ?

Thanks, Erwan

2015-03-16 13:35:22 -0500 received badge  Good Answer (source)
2015-02-13 08:54:40 -0500 commented answer Ubuntu 12.04 on PR2 is unable to install libfreenect-dev

Hi Devon, we did a "sudo apt-get update" and the robot is connected to the internet, on our building network (we updated some packages just before). I let Ricardo provide complementary information.

2015-02-12 12:02:12 -0500 answered a question Question about topics

If your node "foo" is publishing on topic "bar", having a "rostopic echo bar" should show what data you are publishing from "foo". If you want two nodes to have a bidirectional connection, you have to connect "node1" to "node2" through topic "bar1" and then "node2" to "node1" through "bar2". Think of topics like input or output of nodes. input with the same name as output will communicate. In the node that have to listen to a certain topic, you have to "subscribe" to this topic. If you want a node to send information from "bar1" output topic to another node with "bar3" input topic, you have to remap to input from the second node to connect to "bar1".

You can do "rosnode info turtlebot_teleop" or "rostopic llist" when the nodes are running to know which topics are available.

2015-01-28 08:13:06 -0500 received badge  Nice Answer (source)
2015-01-28 06:45:19 -0500 answered a question ROS subscriber/publisher communication

Hello,

As far as I know, there is no publication on a topic if no node has subscribed to it. When there is at least one, message are published depending on the rate of publishing node.

If there are two nodes publishing on the same topic, messages will come one after the other in a non-predictable order. The subscriber will get these messages as they come. It may be conflicting (if you have a movement control node and the teleop node publishing speeds to the low-level controller, your robot may move strangely).

About queues :

ros::Subscriber subscribe(const std::string& topic, uint32_t queue_size, <callback>, const ros::TransportHints& transport_hints = ros::TransportHints());

the queue_size argument tells the node how many messages it should keep before erasing the oldest one. A value of 1 will keep the last message received. I guess that all subscribers having a queue_size on 1 means that you have at most "Nb of Callbacks" messages to process when spinningOnce.

So for you two last questions : subscribing nodes handle their own callbackQueue that is being processed when spinning. It can overflow if publishers are faster that subscribers and callback processing.

I let someone more used to the precise mechanisms of ROS give more details.

2015-01-27 07:08:05 -0500 answered a question How to navigate without localization

In addition to Peter's answer, you can also write a reactive controller driven directly by a twist message on the cmd_val topic (see http://answers.ros.org/question/33545... ). This implies computing movement speed from target in the field of view, computing a repulsive obstacle avoidance from depth pointcloud and summing them to get an egocentric speed. I think it requires more work than use map information but may be more low-level and simpler than using a full navigation stack.

2015-01-22 03:19:36 -0500 commented answer Push_back doesn't work

I don't get what you want to do at the end, but this solution is in my opinion a good way to push Points into PointCloud, independantly from the source. From your example I understand that you want to add input->pose to the pointcloud, what your code does. Maybe you could explain the final goal ?

2015-01-19 15:41:07 -0500 received badge  Nice Answer (source)
2015-01-19 06:49:06 -0500 commented answer Push_back doesn't work

Edited my answer, see above.