Ask Your Question

Cerin's profile - activity

2019-10-15 04:07:18 -0500 received badge  Notable Question (source)
2019-10-15 04:07:18 -0500 received badge  Famous Question (source)
2019-10-12 09:21:22 -0500 received badge  Popular Question (source)
2019-10-12 09:21:22 -0500 received badge  Notable Question (source)
2019-10-07 15:46:03 -0500 received badge  Nice Question (source)
2019-09-20 02:38:18 -0500 marked best answer How to specify a custom rostoolchain.cmake when compiling with catkin?

I'm attempting to cross-compile ROS for ARM on my x86-64 laptop. To do this, I'm trying to run catkin_make_isolated with this rostoolchain.cmake file:

#File rostoolchain.cmake
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)

# Have to set this one to BOTH, to allow CMake to find rospack
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

And I'm calling it like:

./src/catkin/bin/catkin_make_isolated --install -DCMAKE_TOOLCHAIN_FILE=/path/to/rostoolchain.cmake -DCMAKE_BUILD_TYPE=Release --install-space /tmp/ros/$ROS_DISTRO -j1

However, the output reports:

CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_TOOLCHAIN_FILE

and the compiler shown is "GNU GCC" instead of "arm-linux-gnueabihf-gcc", implying my custom cmake file is being ignored.

How do I fix this? What's the proper way to cross-compile ROS for ARM on x86?

There's almost no documentation of this in the wiki. I found this page, but it's not very descriptive and hasn't been updated in three years.

2019-08-13 05:25:13 -0500 received badge  Famous Question (source)
2019-05-26 20:48:53 -0500 marked best answer How to execute command inside launch file?

How do you run a command inside a launch file to set a param value?

I have launch file like:

<launch>
    <group ns="motor_arduino">
        <node pkg="rosserial_python" type="serial_node.py" name="serial_node" output="screen">
            <param name="~port" value="/dev/ttyACM0" />
            <param name="~baud" value="115200" />
        </node>
    </group>
</launch>

which allows communication with one of several Arduino Unos connected to the host computer. However, I've found that the mount path /dev/ttyACM0 is variable, and based on how the Arduino's initialize, this may be /dev/ttyACM0 or /dev/ttyACM1.

To fix this problem, I've written a script that reads the output of udevadm info --query=all --name=/dev/ttyACM* and determines the correct device path to use. However, how do I call this script from inside the launch file to set the port param dynamically?

The docs show that roslaunch does support some simply substitution commands, but I don't see a way to run an arbitrary script, e.g.

<param name="~port" value="$(identify_port.py device1)" />

gives me the error:

Unknown substitution command [identify_port.py device1]. Valid commands are ['find', 'env', 'optenv', 'anon', 'arg']
2019-05-20 01:43:14 -0500 marked best answer QR Code Detector?

Is anyone aware of a QR code detector library, preferrably in Python, that's efficient enough to locate and track QR Codes in an image in real-time? I'm trying to program a small robot to search for a specific QR code, and then once it's found, track its movement and follow it around.

I've found a ton of encoders, for generating QR Codes, and decoders, for reading the text from the pristine generated images, but there seems to almost nothing for detecting QR codes from raw noisy images or video feeds. Considering how many QR reading Android apps there are, I find this difficult to believe.

I've found a few proof-of-concept tutorials like this and this, but these look like hacky one-offs that are no longer maintained, or even packaged properly.

I've also found a couple ROS projects like this and this, but these also look unmaintained, as well as enormously over-complicated, and need extensive calibration. Is there anything else I'm missing?

2019-05-20 01:38:46 -0500 marked best answer How to make IMU orientation reflect in Rviz

I've built a small R2D2 like robot composed of three parts, a cylindrical torso, a panning cylindrical neck, and tilting spherical head, all equally modeled in a URDF file. There's also an IMU positioned at the front-collar of the torso cylinder, and a camera positioned at the front of the head sphere.

With a tf/robot_state_publisher node running, I can visualize my robot in Rviz like:

image description

My IMU is publishing standard Imu messages to the /imu/data_raw topic, which Rviz is displaying and rendering as a separate axis. It's difficult to see from the cluttered display, but it's the unlabeled axis at the bottom that's rotated askew from the rest of the model. When I rotate my robot, and thus rotating the IMU, the IMU's axes correctly pans/tilts/yaws in Rviz. However, the rest of the robot remains stationary. For example, when I lay my robot on its side, here's how Rviz renders it:

image description

Notice the IMU's green y-axis is now pointing straight up, but the rest of the robot remains unchanged. If my robot starts moving via its wheels, and thus updates odometry information on the standard /odom topic, it begins moving in Rviz, but any pan/tilt/yaw is not reflected. How do I fix this?

If I'm publishing IMU data, and my IMU is represented by a linkage connected via a fixed joint to my base_link, then why isn't Rviz showing the IMU movement as a separate axis instead of apply it to the base_link?

Is the problem happening because I've not correctly linked up my IMU data to a linkage? Is it a mistake to try and apply IMU data to an IMU linkage, or should I instead merge my IMU's orientation data directly into my odometry messages and forget trying to explicitly model the IMU in URDF altogether?

I wanted to model the IMU in URDF to help TF take into account it's asymmetric placement (forward of the centerline).

My URDF looks like:

<?xml version="1.0" encoding="UTF-8"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="myrobot">
    <xacro:include filename="$(find ros_myrobot_description)/urdf/materials.urdf.xacro" />
    <xacro:property name="torso_radius" value="0.075" /><!-- 150 mm diameter = 75 mm radius -->
    <xacro:property name="torso_height" value="0.16" /><!-- 160 mm height -->
    <xacro:property name="neck_height" value="0.015" />
    <xacro:property name="camera_radius" value="0.008" />
    <xacro:property name="camera_thickness" value="0.005" />
    <xacro:property name="M_PI" value="3.141592653589793" />

    <link name="base_link">
        <visual>
            <geometry>
                <cylinder length="${torso_height}" radius="${torso_radius}" />
            </geometry>
            <origin xyz="0 0 ${torso_height/2}" rpy="0 0 0" />
            <material name="red" />
        </visual>
    </link>

    <link name="imu">
        <visual>
            <geometry>
                <box size=".03 .015 .01" />
            </geometry>
            <origin xyz="0 0 0" rpy="0 0 0" />
            <material name="orange" />
        </visual>
    </link>

    <link name="neck">
        <visual>
            <geometry>
                <cylinder length="${neck_height}" radius="${torso_radius}" />
            </geometry>
            <origin xyz="0 0 ${neck_height/2}" rpy="0 0 0" />
            <material name="green" />
        </visual>
    </link>

    <link name="head">
        <visual ...
(more)
2019-05-20 01:25:35 -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?

2019-05-20 01:25:10 -0500 received badge  Famous Question (source)
2019-05-20 01:25:10 -0500 received badge  Notable Question (source)
2019-04-19 00:49:00 -0500 received badge  Necromancer (source)
2019-04-11 09:38:42 -0500 received badge  Nice Answer (source)
2019-04-09 03:32:10 -0500 received badge  Famous Question (source)
2019-04-08 01:20:56 -0500 marked best answer Merging odometry with imu data

I have a node monitoring dual motor encoders and publishing odometry to the standard /odom. I also have an IMU with a compass providing true orientation about the z axis.

I'm currently calculating the effective z orientation just from the wheel velocities, as explained in this answer. Should I instead use the z orientation provided by the IMU, since that's absolute? Or should wheel odometry and IMU data be kept separate and merged later into a new topic?

2019-04-08 01:09:12 -0500 marked best answer Unable to start robot state publisher due to missing library

When I try to launch robot_state_publisher with the launch file:

<launch>
    <arg name="model" default="$(find mybot_description)/urdf/mybot.urdf.xacro"/>
    <param name="robot_description" command="$(find xacro)/xacro --inorder $(arg model)" />
    <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
</launch>

it dies with the error:

/opt/ros/kinetic/lib/robot_state_publisher/state_publisher: error while loading shared libraries: librobot_state_publisher_solver.so: cannot open shared object file: No such file or directory

Obviously, I have the ros-kinetc-robot-state-publisher package installed. Why is it throwing this error? Searching apt-cache finds nothing providing that .so file.

2019-04-07 22:39:38 -0500 marked best answer How to run tests in a ROS package?

I've written a ROS package, containing some nodes/scripts/messages etc, all laid out using the recommended folder structure. I'm not trying to execute some tests using the standard catkin_make run_tests and I'm getting the error:

The specified base path "my_ros_package" contains a package but "catkin_make" must be invoked in the root of workspace

If I'm reading this correctly, it's saying I need to create a ROS workspace...just to run tests? This seems a little strange to me. I've written a ton of unittests for Python packages, mostly using the Tox tool, and this handles creating a virtualenv, installing all your dependencies, and then running your tests, all from your Python package. I've never had to create a second Python package just to run my first package's tests.

If you've created a ROS project in a git repo, how are you supposed to test it? Create another git repo containing a "test" ROS workspace...which then clones your first repo? That seems redundant.

2019-04-07 22:36:54 -0500 marked best answer How to dynamically launch and kill nodes?

Is there any best practice and/or guides surrounding how to dynamically launch and kill nodes?

I'm building a small Raspberry Pi based robot, and since it only has 1GB of memory and limited CPU, I don't want every possibly node I use to be loaded, because even a node that's "standing by" consumes about 2-3% of memory.

For example, say I want to start a procedure that looks for QR codes in a video stream. If I don't normally do this, it doesn't make sense to have a QR tracking node running at all times, so I'll want to dynamically launch the node as needed, and then kill it when the procedure is complete. What's the best way to do this using rospy?

2019-04-02 21:45:47 -0500 received badge  Notable Question (source)
2019-04-02 06:09:32 -0500 received badge  Popular Question (source)
2019-03-14 00:41:00 -0500 received badge  Famous Question (source)
2019-02-05 13:45:24 -0500 received badge  Famous Question (source)
2019-01-31 00:10:33 -0500 received badge  Famous Question (source)
2019-01-12 14:38:56 -0500 received badge  Popular Question (source)
2019-01-12 14:38:56 -0500 received badge  Notable Question (source)
2019-01-07 08:34:51 -0500 received badge  Famous Question (source)
2018-12-24 12:23:57 -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()?

2018-12-18 10:20:53 -0500 received badge  Popular Question (source)
2018-12-18 10:20:53 -0500 received badge  Notable Question (source)
2018-12-11 17:25:22 -0500 received badge  Famous Question (source)
2018-12-10 06:57:38 -0500 received badge  Famous Question (source)
2018-12-10 06:57:38 -0500 received badge  Notable Question (source)
2018-12-02 09:29:30 -0500 received badge  Popular Question (source)
2018-12-02 09:29:30 -0500 received badge  Notable Question (source)
2018-12-02 09:29:30 -0500 received badge  Famous Question (source)
2018-11-29 09:12:23 -0500 marked best answer Difference between roslaunch and rosrun with image_view

If I run:

rosrun image_view stereo_view stereo:=raw_stereo image:=image_rect _approximate_sync:=true

I see the correct left and right channels of my stereo camera and a stereo depth map.

However, if I use roslaunch to run the equivalent launch file:

<launch>
    <node name="stereo_view" pkg="image_view" type="stereo_view">
        <param name="stereo" value="raw_stereo" />
        <param name="image" value="image_rect" />
        <param name="_approximate_sync" value="true" />
    </node>
</launch>

all I see are gray screens. What is the difference in the launch file that causes it to fail?

2018-11-25 21:38:35 -0500 received badge  Famous Question (source)
2018-10-31 14:09:38 -0500 received badge  Notable Question (source)
2018-10-31 14:09:11 -0500 received badge  Popular Question (source)
2018-10-30 01:59:07 -0500 received badge  Famous Question (source)