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

Marc Testier's profile - activity

2023-04-12 17:18:03 -0500 received badge  Great Question (source)
2022-07-30 21:28:12 -0500 received badge  Good Question (source)
2022-02-24 03:37:13 -0500 received badge  Nice Question (source)
2021-09-09 09:01:55 -0500 received badge  Taxonomist
2020-06-23 19:53:30 -0500 marked best answer ROS2 and Rviz : only displays values with a radius < 1 meter around the laser

Hello,

I'm using ROS2 bouncy and Rviz, both built from source on Ubuntu 18.04 and I'm trying to display the laser scan on Rviz, but it only shows the value that are on a 1 meter radius around the laser.

Did I miss a parameter in Rviz ? Is it a bug ?

A bit more details : I'm using an Hokuyo ust-20lx, which is supposed to have ~20 meters range, with the urg_node package from link text which is a version for Beta2 (or maybe Ardent, not sure) that I have just slightly modified to make it work on Bouncy. Everything works fine and I've checked the published values which are normals, but rviz only shows values whose range is < 1 meter. I have tried the laser on ROS1 melodic with the urg_node and rviz and it shows the normal values.

Any suggestion ? Should I post an issue on rviz' github ?

2020-06-23 19:53:08 -0500 received badge  Nice Question (source)
2020-05-01 01:27:57 -0500 received badge  Famous Question (source)
2020-04-22 11:43:55 -0500 received badge  Nice Question (source)
2020-04-22 11:40:27 -0500 received badge  Nice Answer (source)
2020-03-22 07:50:29 -0500 received badge  Notable Question (source)
2020-02-27 19:26:25 -0500 received badge  Popular Question (source)
2020-02-18 18:20:33 -0500 marked best answer Trying to compile a ROS 2 Eloquent package depending on a pure cmake package using colcon

Hello there,

I have been fighting for some time with CMakeLists trying to compile a ROS 2 Eloquent package (bar) depending on a pure cmake package (foo) using colcon but I get the following error:

<...>/bar.hpp:5:10: fatal error: foo/foo.hpp: No such file or directory #include "foo/foo.hpp"

I've made a minimal repo showing my problem here: https://github.com/MarcTestier/ros2_c....

The install folder of the cmake package (foo) seems somewhat normal though, its folder tree looks like this:

install/foo/  
├── include  
│   └── foo  
│       ├── foo.hpp  
│       └── foo_export.h  
├── lib  
│   └── libfoo.so  
└── share  
    ├── colcon-core  
    │   └── packages  
    │       └── foo  
    └── foo  
        ├── cmake  
        │   ├── fooConfig.cmake  
        │   ├── fooConfigVersion.cmake  
        │   ├── fooTargets-noconfig.cmake  
        │   └── fooTargets.cmake  
        ├── hook  
        │   ├── cmake_prefix_path.dsv  
        │   ├── cmake_prefix_path.ps1  
        │   ├── cmake_prefix_path.sh  
        │   ├── ld_library_path_lib.dsv  
        │   ├── ld_library_path_lib.ps1  
        │   ├── ld_library_path_lib.sh  
        │   ├── pkg_config_path.dsv  
        │   ├── pkg_config_path.ps1  
        │   ├── pkg_config_path.sh  
        │   ├── pkg_config_path_multiarch.dsv  
        │   ├── pkg_config_path_multiarch.ps1  
        │   └── pkg_config_path_multiarch.sh  
        ├── package.bash  
        ├── package.dsv  
        ├── package.ps1  
        ├── package.sh  
        └── package.zsh

It seems like the ROS 2 package (bar) has trouble finding the cmake package (foo) library and headers but find_package(foo) works.

I found an ugly solution (available in the repo here) which consists of 2 steps:

1.Manually add the include directory

get_filename_component(INSTALL_DIR ${CMAKE_INSTALL_PREFIX} DIRECTORY)
include_directories(${INSTALL_DIR}/foo/include/)

If I only perform step 1, I can find the header files but I get an error: /usr/bin/ld: cannot find -lfoo which I guess means that even though I do the following:

target_link_libraries(Bar foo)

Bar still can't properly find the foo library.

2.If on top of the first step I link directly against the .so file:

target_link_libraries(Bar "${INSTALL_DIR}/foo/lib/libfoo.so")

Now the packages can compile but the solution seems a bit ugly.

I'm out of idea and I can't tell if the problem comes from a pure cmake problem, colcon moving/linking stuff around or anything else so any suggestions are welcomed, thanks.

2020-02-18 18:20:26 -0500 commented answer Trying to compile a ROS 2 Eloquent package depending on a pure cmake package using colcon

It works, thank you for the help!!

2020-02-17 23:38:23 -0500 asked a question Trying to compile a ROS 2 Eloquent package depending on a pure cmake package using colcon

Trying to compile a ROS 2 Eloquent package depending on a pure cmake package using colcon Hello there, I have been figh

2020-01-28 02:33:09 -0500 marked best answer ROS2 : How to call a service from the callback function of a subscriber ?

Hello,

This question is actually related to : https://answers.ros.org/question/3018...

But I wrote a minimal example and wanted to have your feedback on how to fix this.

So I'm using ROS2 Bouncy, built from source on Ubuntu 18.04. I have a node that subscribe to a topic and in the callback function of the sub, I get stuck if I try to rclpy.spin_once(self).

I wrote a minimal package to show the problem, which can be found here : https://github.com/MarcTestier/test_r...

I was actually trying to call a service from the callback function but got stuck when doing rclpy.spin_until_future_complete(node, future) to get the answer form the service.

So any idea how to call a service from the callback function of a subscriber ?? Maybe threads ??

Thanks.

2019-11-27 15:04:00 -0500 received badge  Nice Answer (source)
2019-09-20 06:16:44 -0500 received badge  Self-Learner (source)
2019-09-20 06:16:44 -0500 received badge  Necromancer (source)
2019-09-19 20:02:03 -0500 edited answer ROS 2 Crystal : Can't get parameter list of string from YAML file

Seems like the issue as been fixed: https://github.com/ros2/rcl/issues/461.

2019-09-19 20:01:47 -0500 marked best answer ROS 2 Crystal : Can't get parameter list of string from YAML file

Hi, I'm using ROS 2 Crystal and I'm trying to get a list of string from a YAML file in Python.
The problem is that my list also contains numbers, I don't mind them being converted into strings so my YAML file looks like:

some_node:
    ros__parameters:
        some_list: ['1', '2', '3', '4', 'some_string']

But the parser keeps converting the strings '1', '2', etc into numbers so I get an error Failed to parse yaml params file ...: Sequence should be of same type. Value type 'string' do not belong at line_num X.

If I change some_string to an int, I do get an ARRAY_INTEGER but that's not what I want.
Any way to force the YAML parser to keep '1' as a string ?

I tried using double quotes "1", I tried adding !!str or !!string but it seems to be ignored and gives the same result.

As a temporary solution, I escape my list with a : and remove it in the code but it's a bit ugly...

some_node:
    ros__parameters:
        some_list: [':1', ':2', ':3', ':4', ':some_string']

Thanks.

edit: Same problem in ROS 2 Dashing.

2019-09-19 20:01:32 -0500 answered a question ROS 2 Crystal : Can't get parameter list of string from YAML file

Seems like the issue as been fixed: https://github.com/ros2/rcl/issues/461, so I'm closing this question.

2019-08-19 02:06:13 -0500 marked best answer ROS 2 Bouncy get_parameter

Hi, I'm using ROS 2 Bouncy and I'm trying to get parameters from a yaml file. I checked a few ways to get parameters and I found one that works but takes 3 lines for each parameter :

auto ip_port_param = rclcpp::Parameter("ip_port", 10940);
nh_->get_parameter("ip_port", ip_port_param);
ip_port_ = ip_port_param.as_int();

Is there a nicer way to get parameters in one line like in ROS 1 ?

pnh_.param<int>("ip_port", ip_port_, 10940);

I could change ip_port_ into a rclcpp::Parameter instead of an int but then I would have to modify the whole code. Would that be the "proper" way to do it ?

I also tried to use rclcpp::SyncParametersClient but I can't use it from within a node, I have to be outside of it (ie: in the main) because the class constructor takes a rclcpp::Node::SharedPtr node. But when I'm in the node if I use this I get a rclcpp::Node* or if I use this->shared_from_this() then it compiles and run but I don't get the parameters, they take the default value.

auto parameters_client = std::make_shared<rclcpp::SyncParametersClient>(this->shared_from_this());
ip_port_ = parameters_client->get_parameter("ip_port", 10940);

All the examples from the demos pkg that use rclcpp::SyncParametersClient, do it from the main and not inside the node.

Whereas for rclcpp::AsyncParametersClient, you can use it inside your node with this but there is no T get_parameter (const std::string &parameter_name, const T &default_value) function, you have to use a get_parameters(...) and then you don't even get the direct values but a vector of Parameter().

Am I missing something or is it just the way we have to get parameters for now ?

Thanks.

Edit : I can do something like :

template <class T>
rclcpp::Parameter get_param (rclcpp::Node* node, std::string param_name, T default_value) {
  auto param = rclcpp::Parameter(param_name, default_value);
  node->get_parameter(param_name, param);
  return param;
}

And then :

ip_port_ = get_param(this, "ip_port", "").as_int();

But I feel like it should be something that's already there.

2019-06-20 09:07:59 -0500 received badge  Famous Question (source)
2019-06-19 19:52:45 -0500 commented question ROS 2 Crystal : Can't get parameter list of string from YAML file

ok, I opened an issue: https://github.com/ros2/rcl/issues/461

2019-06-18 20:42:53 -0500 received badge  Notable Question (source)
2019-06-12 07:09:17 -0500 received badge  Popular Question (source)
2019-06-11 21:23:11 -0500 edited question ROS 2 Crystal : Can't get parameter list of string from YAML file

ROS 2 Crystal : Can't get parameter list of string from YAML file Hi, I'm using ROS 2 Crystal and I'm trying to get a li

2019-06-11 03:19:51 -0500 edited question ROS 2 Crystal : Can't get parameter list of string from YAML file

ROS 2 Crystal : Can't get parameter list of string from command line Hi, I'm using ROS 2 Crystal and I'm trying to get a

2019-06-11 03:16:49 -0500 asked a question ROS 2 Crystal : Can't get parameter list of string from YAML file

ROS 2 Crystal : Can't get parameter list of string from command line Hi, I'm using ROS 2 Crystal and I'm trying to get a

2019-02-26 17:26:18 -0500 marked best answer ROS 2 Bouncy : Node, Log and Classes best practice

Hello I am working with ROS 2 Bouncy and was wondering what is the best practice to log stuff in classes that are instantiated in a Node ?

I know it's now recommended to inherit the rclcpp::Node class and you can simply log by doing RCLCPP_INFO(this->get_logger(), "My message").

My question is about the best practice to log in customs classes inside the Node. For example, let's say we have this class :

class MyNodeClass : public rclcpp::Node
{
public:
  MyNodeClass()
  : Node("my_node_class") {
    CustomClass custom_class();
  }

  MyNodeClass::do_stuff(){
    custom_class.do_stuff();
  }
}

Which of this 4 options is the recommended way to give CustomClass access to the logger ?

Option 1 : We give the Node to the CustomClass constructor which save it in some var to be able to log in any function.

MyNodeClass : public rclcpp::Node
{
public:
  MyNodeClass()
  : Node("my_node_class") {
    CustomClass custom_class(this);
  }

  MyNodeClass::do_stuff(){
    custom_class.do_stuff();
  }
}

Option 2 : We give the logger to the CustomClass constructor which save it in some var to be able to use it in any function.

MyNodeClass : public rclcpp::Node
{
public:
  MyNodeClass()
  : Node("my_node_class") {
    CustomClass custom_class(this->get_logger());
  }

  MyNodeClass::do_stuff(){
    custom_class.do_stuff();
  }
}

Option 3 : We give the node to each CustomClass function if they need to log stuff.

class MyNodeClass : public rclcpp::Node
{
public:
  MyNodeClass()
  : Node("my_node_class") {
    CustomClass custom_class();
  }

  MyNodeClass::do_stuff(){
    custom_class.do_stuff(this);
  }
}

Option 4 : We only give the Node's logger to each CustomClass function.

class MyNodeClass : public rclcpp::Node
{
public:
  MyNodeClass()
  : Node("my_node_class") {
    CustomClass custom_class();
  }

  MyNodeClass::do_stuff(){
    custom_class.do_stuff(this->get_logger());
  }
}

Any other option ? Does any of this really matter or can we choose any option ?

Thank you.

2019-02-26 17:20:10 -0500 received badge  Famous Question (source)
2019-02-15 02:53:29 -0500 marked best answer Ros 2 command line service call with array of custom msg

Hi,

I'm using ROS 2 Bouncy on Ubuntu 18 and I'm trying to call a service from command line. I can't seem to formulate a good srv while using the command line and get an error : Failed to populate field 'array': The 'array' field must be a set or sequence and each value of type 'LiftId'

The command I'm using is :

ros2 service call /get_lift_info_array kone_open_opc_interfaces/GetLiftInfoArray "
{
    array: [
        {
            gateway_ip: 'a', 
            gateway_port: 1, 
            opc_serv_ip: 'b', 
            opc_serv_type: 'v', 
            site: 'd', 
            location: 'e', 
            group: 'f', 
            lift: 'g'
        }
    ]
}"

So I have a srv file called GetLiftInfoArray.srv:

LiftId[] array
---

And LiftId.msg is defined as bellow:

string gateway_ip
int32 gateway_port
string opc_serv_ip
string opc_serv_type
string site
string location
string group
string lift

To note that I can make it works when the array is empty :

ros2 service call /get_lift_info_array kone_open_opc_interfaces/GetLiftInfoArray "
{
    array: [
    ]
}"

And I can also make it works when I use a python file with a client calling the service :

...
cli = node.create_client(GetLiftInfoArray, 'get_lift_info_array')

req = GetLiftInfoArray.Request()
req.array = []
lift_id = LiftId()
lift_id.gateway_ip = 'a'
lift_id.gateway_port = 1
lift_id.opc_serv_ip = 'b'
lift_id.opc_serv_type = 'c'
lift_id.site = 'd'
lift_id.location = 'e'
lift_id.group = 'f'
lift_id.lift = 'g'
req.array.append(lift_id)
...

It works, but I would like to be able to use the command line, does anyone have any idea of what's wrong with my command ?

Thank you.

2019-02-11 04:13:01 -0500 received badge  Famous Question (source)
2019-01-30 11:54:39 -0500 received badge  Self-Learner (source)
2019-01-16 08:24:23 -0500 received badge  Notable Question (source)