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

Cerin's profile - activity

2023-10-04 19:54:49 -0500 received badge  Famous Question (source)
2022-10-19 10:24:40 -0500 received badge  Nice Question (source)
2022-05-31 14:44:54 -0500 received badge  Nice Question (source)
2022-05-15 12:16:50 -0500 received badge  Notable Question (source)
2022-05-15 12:16:50 -0500 received badge  Famous Question (source)
2022-04-02 14:20:28 -0500 marked best answer How to publish Int16MultiArray from command line?

I have a C++ subscriber that listens for a message composed of a two integers, which I've implemented with a std_msgs::Int16MultiArray message type like:

void on_motor_speed(const std_msgs::Int16MultiArray& msg){
    ///do stuff
}
ros::Subscriber<std_msgs::Int16MultiArray> motor_speed_sub("motor/speed", &on_motor_speed);

Is there an easier way to do this?

How do I test this from the command line using rostopic pub? Based on this question, I think is should be something like:

rostopic pub motor/speed std_msgs/Int16MultiArray "{layout:{dim:[{label:'', size:0, stride:0}], data_offset:0}, data:[64, 64]}"

but I get the YAML parsing error:

Usage: rostopic pub /topic type [args...]

rostopic: error: Argument error: while scanning a plain scalar
  in "<string>", line 1, column 16:
    {layout:{dim:[{label:'', size:0, stride:0}], da ... 
                   ^
found unexpected ':'
  in "<string>", line 1, column 21:
    {layout:{dim:[{label:'', size:0, stride:0}], data_of ... 
                        ^
Please check http://pyyaml.org/wiki/YAMLColonInFlowContext for details.

As far as I know, YAML does support the inline syntax, and doesn't need to be multi-line. What am I doing wrong?

2022-03-05 22:59:35 -0500 received badge  Famous Question (source)
2022-01-17 21:20:21 -0500 received badge  Nice Question (source)
2021-08-23 23:18:52 -0500 marked best answer Catkin_make not installing Python dependencies

How do you make catkin_make install all Python package dependencies via pip?

I've written a simple Python package with a setup.py file like:

#!/usr/bin/env python
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
    version='0.0.1',
    packages=['mypackage'],
    package_dir={'': 'src'},
    install_requires=['somepackage'],
)
setup(**d)

And my CMakeLists.txt includes catkin_python_setup().

However, when I run catkin_make and source devel/setup.sh, somepackage isn't installed into the virtual environment.

2021-08-03 02:27:26 -0500 received badge  Guru (source)
2021-08-03 02:27:26 -0500 received badge  Great Answer (source)
2021-07-19 03:13:46 -0500 received badge  Good Question (source)
2021-05-26 15:40:52 -0500 marked best answer How to launch nodes with realtime priority

Is there any built-in mechanism to control the nice value for a ROS node?

I have a node that exposes a simple service for generating speech via espeak. Usually, the generated speech sounds fine, but sometimes when the CPU is under load, the speech will sound slow and stuttering.

I can improve this by manually setting my speech node to run in near-realtime via nice, but that feels hacky. Is there a formal way to do this in ROS?

2021-05-05 11:21:39 -0500 received badge  Great Question (source)
2021-04-23 08:08:21 -0500 received badge  Famous Question (source)
2021-04-14 07:21:44 -0500 marked best answer What is the purpose of base_footprint?

What purpose does the base_footprint link serve?

I'm reading through the Gazebo simulation tutorial, and it instructs the user to create an infinitesimally small nearly weightless box which is linked to the base_link, but it doesn't explain what this is or what it's used for, nor does it link to any resources that do. I did see this similar question, but that answer doesn't really explain why such a link is used. Why does any part of ROS need to know how the model projects onto the ground?

Does every Gazebo model require this link?

Edit: I've noticed the joint linking the footprint to the base_link has an origin whose z component represents a fixed distance from the ground. What value do you use for a legged model that doesn't have a fixed distance from the ground?

2021-04-03 10:02:35 -0500 marked best answer How to run image_proc with roslaunch

How do you write a launch file to pipeline a color usb camera into image_proc, convert it to mono, and display it in a window?

To display a color usb webcam, this simple launch file works well:

webcam_color.launch:

<launch>
  <node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen" >
    <param name="video_device" value="/dev/video1" />
    <param name="image_width" value="640" />
    <param name="image_height" value="480" />
    <param name="pixel_format" value="mjpeg" />
    <param name="camera_frame_id" value="usb_cam" />
    <param name="io_method" value="mmap" />
  </node>
  <node name="image_view" pkg="image_view" type="image_view" respawn="false" output="screen">
    <remap from="image" to="/usb_cam/image_raw" />
    <param name="autosize" value="true" />
  </node>
</launch>

However, I can't find any examples of using image_proc in a launch file. I can pipe the color video stream into image_proc and display the mono using:

roslaunch mypkg webcam_test.launch
ROS_NAMESPACE=usb_cam rosrun image_proc image_proc
rosrun image_view image_view image:=/usb_cam/image_mono

What would be the equivalent of doing this all in a single launch file?

2021-03-31 04:58:15 -0500 marked best answer How to install and launch Python node inside a virtualenv?

I'm writing a Python ROS node, and all the documentation seems to assume I've installed all my package dependencies into the global site-packages. Best practices in the Python world is to use a virtualenv. However, I can't find anything in the tutorials that mentions this. When launching my node, is it enough to source my virtualenv, or is there some special configuration I need to do first?

2021-03-25 21:38:45 -0500 marked best answer How to include a library in CMakeLists

What's the proper way to include external libraries in a C++ ROS package?

I've written a C++ program that reads data from an I2C device using the I2Cdevlib, and now I'm trying to re-package it as a ROS node and build it via catkin.

I'm building the non-catkin code via:

gcc -o mpu6050_reader ${PATH_I2CDEVLIB}RaspberryPi_bcm2835/MPU6050/examples/MPU6050_example_1.cpp \
 -I ${PATH_I2CDEVLIB}RaspberryPi_bcm2835/I2Cdev ${PATH_I2CDEVLIB}RaspberryPi_bcm2835/I2Cdev/I2Cdev.cpp \
 -I ${PATH_I2CDEVLIB}Arduino/MPU6050/ ${PATH_I2CDEVLIB}Arduino/MPU6050/MPU6050.cpp -l bcm2835 -l m

I've initialized a C++ ROS package, and refactored MPU6050_example_1.cpp into the ROS-equivalent mpu6050_node.cpp, and now I'm trying to translate the above call to CMakeLists.txt so it compiles with catkin_make. What's the best way to do this?

Should I include the i2cdevlib and bcm2835 libraries in my package, or require the user to download and install them separately?

I've read through the documentation on CMakeLists.txt, but it's unclear to me which parameters I should use. Should I use add_library() or include_directories() or add_dependencies() or target_link_libraries()?

2021-03-25 12:15:30 -0500 received badge  Nice Question (source)
2021-03-24 07:01:34 -0500 marked best answer Publishing diagnostics from C++?

Are there any examples of how to publish diagnostics messages from C++? I can only find examples using Python.

2021-03-03 16:15:42 -0500 received badge  Notable Question (source)
2021-03-03 16:15:42 -0500 received badge  Famous Question (source)
2021-02-27 22:47:09 -0500 received badge  Famous Question (source)
2021-02-27 22:47:09 -0500 received badge  Notable Question (source)
2021-02-27 22:47:09 -0500 received badge  Popular Question (source)
2021-02-26 17:07:56 -0500 received badge  Notable Question (source)
2021-02-26 17:07:56 -0500 received badge  Famous Question (source)
2021-02-17 01:28:18 -0500 received badge  Famous Question (source)
2021-02-11 09:27:32 -0500 marked best answer How do you cancel an actionlib action?

How does an actionlib client cancel an ongoing action?

The docs clearly explain how to code an actionlib server to react to a cancellation request and exit, but I can't find any example of how this is initiated by the client.

2021-02-05 20:35:59 -0500 marked best answer How to write ROS integration tests?

How do you write ROS integration tests, where you simulate a running node?

I've written some custom ROS nodes, and now I want to create some automated tests to confirm that they publish certain messages in response to receiving certain messages. These docs briefly mention integration tests and running tests "as a node", but they don't make any sense to me. The example given doesn't actually test the node, and only runs a toy self.assertEquals(1, 1).

For my test, I want to start roscore, several dependency nodes, my custom node, then publish messages, then wait N seconds for my node to publish its own messages, and fail if this doesn't happen. Is there any documentation on how to achieve this?

2021-01-27 23:56:06 -0500 marked best answer How to shutdown all nodes

What's the easiest way to signal all nodes to shutdown?

I created a daemon that runs several launch files in the background, but now that even if I kill the roscore, the other nodes don't end, they just keep running, forcing me to hunt them down and manually kill each process.