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

Dben's profile - activity

2023-11-01 11:35:38 -0500 received badge  Popular Question (source)
2023-11-01 11:35:38 -0500 received badge  Notable Question (source)
2023-06-09 01:22:01 -0500 received badge  Notable Question (source)
2023-03-12 15:22:17 -0500 received badge  Notable Question (source)
2023-03-12 15:22:17 -0500 received badge  Popular Question (source)
2023-03-01 19:24:15 -0500 received badge  Notable Question (source)
2023-02-25 07:34:39 -0500 received badge  Popular Question (source)
2023-02-22 09:52:34 -0500 asked a question Wait result of a callback before executing another subscribed to same topic

Wait result of a callback before executing another subscribed to same topic I have 2 functions, in which each has a subs

2023-02-15 02:54:16 -0500 received badge  Famous Question (source)
2023-02-07 06:57:59 -0500 received badge  Popular Question (source)
2023-02-06 04:37:38 -0500 received badge  Famous Question (source)
2023-02-06 04:37:38 -0500 received badge  Popular Question (source)
2023-02-06 04:37:38 -0500 received badge  Notable Question (source)
2022-12-04 07:28:33 -0500 asked a question Is it possible to drop or keep message in ApproximateTimeSynchronizer?

Is it possible to drop or keep message in ApproximateTimeSynchronizer? Hi, I have used the python ApproximateTimeSynchro

2022-12-01 02:21:58 -0500 asked a question How to write a vendor package using vcpkg?

How to write a vendor package using vcpkg? Hi, I'm trying to package in a vendor package to avoid installing it manually

2022-11-20 05:52:02 -0500 received badge  Famous Question (source)
2022-11-19 14:41:42 -0500 commented answer Generic message to JSON converter in C++?

Thanks! I could use https://github.com/mircodezorzi/tojson . I added my solution as an edit using this library. I hesita

2022-11-19 14:40:20 -0500 edited question Generic message to JSON converter in C++?

Generic message to JSON converter in C++? Hi, I'm trying to convert a message into a json string. While it only takes 2

2022-11-19 14:37:15 -0500 commented answer Generic message to JSON converter in C++?

Thanks! I could use https://github.com/mircodezorzi/tojson

2022-11-19 14:36:59 -0500 marked best answer Generic message to JSON converter in C++?

Hi, I'm trying to convert a message into a json string.

While it only takes 2 lines in python, this seems more complex in C++.

I have a working example for 1 message type (geometry/msgs/Twist)

void Foo::cmdVelCb(geometry_msgs::msg::Twist::SharedPtr msg)
{
    std::string yaml_str = rosidl_generator_traits::to_yaml(*msg);
    YAML::Node yaml_node = YAML::Load(yaml_str);

    dc_interfaces::msg::StringStamped pub_msg;
    nlohmann::json data_json;
    data_json["linear"]["x"] = yaml_node["linear"]["x"].as<float>();
    data_json["linear"]["y"] = yaml_node["linear"]["y"].as<float>();
    data_json["linear"]["z"] = yaml_node["linear"]["z"].as<float>();
    data_json["angular"]["x"] = yaml_node["angular"]["x"].as<float>();
    data_json["angular"]["y"] = yaml_node["angular"]["y"].as<float>();
    data_json["angular"]["z"] = yaml_node["angular"]["z"].as<float>();
}

But now I would like to have a generic way to do it since I will have many more types to handle. Any suggestion?

Thanks

Answer: I could not achieve a generic one but did this using https://github.com/mircodezorzi/tojson

std::string yaml_str = geometry_msgs::msg::to_yaml(*msg);
YAML::Node yaml_node = YAML::Load(yaml_str);
json data_json = tojson::detail::yaml2json(yaml_node);

This still requires to pass geometry_msgs::msg::to_yaml which I would have liked to avoid.

2022-11-19 14:36:52 -0500 received badge  Notable Question (source)
2022-11-19 14:36:52 -0500 received badge  Popular Question (source)
2022-11-08 05:18:55 -0500 edited question Generic message to JSON converter in C++?

Generuc message to JSON converter in C++? Hi, I'm trying to convert a message into a json string. While it only takes 2

2022-11-08 05:18:42 -0500 asked a question Generic message to JSON converter in C++?

Generuc message to JSON converter in C++? Hi, I'm trying to convert a message into a json string. While it only takes 2

2022-10-23 12:54:00 -0500 commented answer How to pass argument to callback in rclc?

Yes, same program, and I think the pointer should work and what I wanted to get, but don't know how

2022-10-23 03:46:23 -0500 commented answer How to pass argument to callback in rclc?

Thanks! My question was more, how do I pass the message type + another variable. Here I can only see the message type be

2022-10-22 18:48:43 -0500 asked a question How to pass argument to callback in rclc?

How to pass argument to callback in rclc? I have a subscription: rclc_executor_add_subscription(&executor, &dat

2022-10-20 11:19:04 -0500 edited question Optional list of strings as launch argument in python

Optional list of strings as launch argument in python How can I pass optional list of strings as parameter on python? H

2022-10-20 11:08:28 -0500 asked a question Optional list of strings as launch argument in python

Optional list of strings as launch argument in python How can I pass optional list of strings as parameter on python? H

2022-10-20 04:16:46 -0500 commented question What is best practice for parameters which are empty lists in ros2

Could you find an answer?

2022-10-06 04:00:59 -0500 received badge  Notable Question (source)
2022-10-06 04:00:59 -0500 received badge  Popular Question (source)
2022-08-31 14:10:06 -0500 edited question Deserialize message with topic name (ROS2)

Deserialize message with topic name (ROS2) I am trying to create a template node that takes as an input a string being t

2022-08-31 13:57:12 -0500 commented question [ROS2] How to communicate ROS2 with external APPs

Hey could you find an answer? I'm looking at forwarding data from ros to external c api

2022-08-31 11:29:31 -0500 edited question Deserialize message with topic name (ROS2)

Deserialize message with topic name (ROS2) I am trying to create a template node that takes as an input a string being t

2022-08-31 11:05:44 -0500 edited question Deserialize message with topic name (ROS2)

Deserialize message with topic name (ROS2) I am trying to create a template node that takes as an input a string being t

2022-08-31 10:49:11 -0500 asked a question Deserialize message with topic name (ROS2)

Deserialize message with topic name (ROS2) I am trying to create a template node that takes as an input a string being t

2022-05-01 04:22:56 -0500 marked best answer Build debian package on ROS2 without recompiling

Hi,

I'm trying to build deb files from my private packages on private repos. Right now, I could loop through each package and build my debs, following this simple script:

mkdir artifacts
sudo apt-get update
sudo apt-get install -y python3-pip fakeroot dpkg-dev debhelper dh-python
pip install bloom
. /opt/ros/galactic/setup.bash
# Already compiled with colcon build
. /root/windrose/install/setup.bash

echo "yaml file:///custom.yaml galactic" >> /etc/ros/rosdep/sources.list.d/20-default.list
rosdep update

OLDIFS=$IFS
IFS=$'\n'
for x in $(colcon list -t --paths); do
    if [[ $(echo $x | awk '{print $3}') == *"ros.ament"* ]]; then
        cd $(echo $x | awk '{print $2}')
        bloom-generate rosdebian
        fakeroot debian/rules binary
        cd $OLDPWD
        deb_location=$(find ~/windrose/src/windrose -name "*.deb")
        dpkg -i $deb_location
        mv $deb_location artifacts
    fi
done

unset OLDIFS
unset IFS

My issues:

  • fakeroot debian/rules binary recompiles the package while I already did it with colcon build. Is there a way to avoid this and use the colcon build workspace?
  • fakeroot debian/rules binary also runs tests, I'd like to disable them with -DBUILD_TESTING=OFF for example, is it possible?

Thanks

2022-04-12 07:00:27 -0500 received badge  Famous Question (source)
2022-04-09 02:59:36 -0500 received badge  Notable Question (source)
2022-04-08 14:56:42 -0500 received badge  Popular Question (source)
2022-04-06 08:26:10 -0500 asked a question Build debian package on ROS2 without recompiling

Build debian package on ROS2 without recompiling Hi, I'm trying to build deb files from my private packages on private

2021-01-22 05:11:18 -0500 commented question Is there a way to build packages "up-to" by passing a directory path?

Thanks, I see what you mean, I will try to simplify over the weekend and come back.

2021-01-22 01:36:02 -0500 commented question Is there a way to build packages "up-to" by passing a directory path?

Thanks for the link. I didn't know there was a name for this! The end goal is to create different bundles with colcon bu

2021-01-20 16:34:26 -0500 commented question Is there a way to build packages "up-to" by passing a directory path?

Yes exactly, thanks. I put all the dependencies in one directory and the core packages in another. Now I'd like to tell

2021-01-20 06:40:24 -0500 asked a question Is there a way to build packages "up-to" by passing a directory path?

Is there a way to build packages "up-to" by passing a directory path? Let's say I have a workspace with: And i want t

2020-05-25 23:03:13 -0500 received badge  Famous Question (source)
2020-03-26 21:08:00 -0500 received badge  Notable Question (source)