Ask Your Question

Hein Wessels's profile - activity

2021-10-11 10:43:43 -0500 marked best answer topic_tools transform works in console but not in launch file

Hello all!

I'm still quite new to ROS, and is getting stuck at something that is most likely a syntax error. I have a /imu topic, and I want to send the imu.orientation.y into a pid. I cannot remap the pid to look at the imu's y field. Therefore, I want to use topic_tools transform function. I can get it to work by typing it into the console, but when I attempt to put it in a launch file the 'transform' dies immediately.

I created a minimal example showing the case where it works, and where it doesn't.


Working example using console

For this case I run the following launch file

<launch>
    <node name="pub" pkg="rostopic" type="rostopic" args="pub /foo std_msgs/Float64 0.5 -r 1" />
</launch>

and then run the following command to start the transform node:

rosrun topic_tools transform /foo /bar std_msgs/Float64 'm'

To prove this works I ran the command rostopic echo \bar and the value 0.5 is printed once per second as expected.


Broken example using launch file

I run the following launch file

<launch>
    <node name="pub" pkg="rostopic" type="rostopic" args="pub /foo std_msgs/Float64 0.5 -r 1" />
    <node name="foobar" pkg="topic_tools" type="transform" args="/foo /bar std_msgs/Float64 'm'"/>
</launch>

This then throws an error upon launching showing that the foobar node died:

... logging to /home/hein/.ros/log/97930396-806f-11ea-85fc-84c5a6fcae4a/roslaunch-hein-Latitude-5500-4511.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://hein-Latitude-5500:39487/

SUMMARY
========

PARAMETERS
 * /rosdistro: melodic
 * /rosversion: 1.14.5

NODES
  /
    foobar (topic_tools/transform)
    pub (rostopic/rostopic)

auto-starting new master
process[master]: started with pid [4522]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 97930396-806f-11ea-85fc-84c5a6fcae4a
process[rosout-1]: started with pid [4533]
started core service [/rosout]
process[pub-2]: started with pid [4536]
process[foobar-3]: started with pid [4537]
ERROR: Wrong input topic (or topic field): /foo
[foobar-3] process has died [pid 4537, exit code 1, cmd /opt/ros/melodic/lib/topic_tools/transform /foo /bar std_msgs/Float64 m __name:=foobar __log:=/home/hein/.ros/log/97930396-806f-11ea-85fc-84c5a6fcae4a/foobar-3.log].
log file: /home/hein/.ros/log/97930396-806f-11ea-85fc-84c5a6fcae4a/foobar-3*.log

Looking at the log file shows the following:

[rospy.client][INFO] 2020-04-16 19:49:16,485: init_node, name[/foobar], pid[2211]
[xmlrpc][INFO] 2020-04-16 19:49:16,485: XML-RPC server binding to 0.0.0.0:0
[xmlrpc][INFO] 2020-04-16 19:49:16,486: Started XML-RPC server [http://hein-Latitude-5500:37033/]
[rospy.init][INFO] 2020-04-16 19:49:16,486: ROS Slave URI: [http://hein-Latitude-5500:37033/]
[rospy.impl.masterslave][INFO] 2020-04-16 19:49:16,486: _ready: http://hein-Latitude-5500:37033/
[rospy.registration][INFO] 2020-04-16 19:49:16,486: Registering with master node http://localhost:11311
[xmlrpc][INFO] 2020-04-16 19:49:16,486: xml rpc node: starting XML-RPC server
[rospy.init][INFO] 2020-04-16 19:49:16,586: registered with master
[rospy.rosout][INFO] 2020-04-16 19:49:16 ...
(more)
2021-10-11 09:07:30 -0500 received badge  Student (source)
2020-12-08 16:07:54 -0500 received badge  Famous Question (source)
2020-11-10 10:33:23 -0500 received badge  Famous Question (source)
2020-08-21 09:10:04 -0500 received badge  Notable Question (source)
2020-05-25 01:56:55 -0500 received badge  Notable Question (source)
2020-05-11 04:50:07 -0500 received badge  Popular Question (source)
2020-04-17 04:10:13 -0500 commented question topic_tools transform works in console but not in launch file

I didn't define any namespaces. What's shown in the question is the complete .launc file. Could that be a problem?

2020-04-17 02:51:56 -0500 commented question topic_tools transform works in console but not in launch file

It's most likely related to the transform namespace bug. Link

2020-04-17 02:08:14 -0500 commented question topic_tools transform works in console but not in launch file

Updated the question as per your request.

2020-04-17 02:07:59 -0500 edited question topic_tools transform works in console but not in launch file

Topic_Tools Transform works in console but not in launch file Hello all! I'm still quite new to ROS, and is getting stu

2020-04-17 02:07:59 -0500 received badge  Editor (source)
2020-04-17 00:55:54 -0500 commented question topic_tools transform works in console but not in launch file

@gvdhoorn, now that you mention it, it does say ERROR: Wrong input topic (or topic field): /foo. Updated the question, a

2020-04-17 00:55:32 -0500 edited question topic_tools transform works in console but not in launch file

Topic_Tools Transform works in console but not in launch file Hello all! I'm still quite new to ROS, and is getting stu

2020-04-17 00:54:51 -0500 commented question topic_tools transform works in console but not in launch file

@gvdhoorn, now that you mention it, it does say ERROR: Wrong input topic (or topic field): /foo. Updated the question, a

2020-04-17 00:54:40 -0500 commented question topic_tools transform works in console but not in launch file

@gvdhoorn, now that you mention it, it does say `ERROR: Wrong input topic (or topic field): /foo'. Updated the question,

2020-04-16 13:47:43 -0500 asked a question topic_tools transform works in console but not in launch file

Topic_Tools Transform works in console but not in launch file Hello all! I'm still quite new to ROS, and is getting stu

2020-04-15 02:05:47 -0500 received badge  Enthusiast
2020-04-06 11:54:59 -0500 commented answer Changing Joint from Fixed to Revolute Breaks TF

That did the trick! I can't believe the issue was a simple copy-paste mistake. Thanks!

2020-04-06 11:54:12 -0500 received badge  Supporter (source)
2020-04-06 11:54:11 -0500 marked best answer Changing Joint from Fixed to Revolute Breaks TF

Hello guys,

I'm fairly new to ROS and still learning. I've been struggling with this problem for a while, and I can't seem to solve it. I've dug through countless ROS Answers, but can't seem to find the solution.

I'm running through the URDF Tutorial and finished it. This is as in, if I run the last 13-diffdrive.launch all starts up correctly. To prove to myself that I know how it works, I attempted to make R2D2's legs also rotate at his shoulders, by changing the joint from fixed to revolute, which also requires a few additional changes as well.


So first what I did was change the following in the *.urdf.xacro file:

<joint name="base_to_${prefix}_leg" type="fixed">
      <parent link="base_link"/>
      <child link="${prefix}_leg"/>
      <origin xyz="0 ${reflect*(width+.02)} 0.25" />
</joint>

to

<joint name="base_to_${prefix}_leg" type="revolute">
      <parent link="base_link"/>
      <child link="${prefix}_leg"/>
      <origin xyz="0 ${reflect*(width+.02)} 0.25" />
      <axis xyz="0 1 0"/>      
      <limit effort="1000.0" lower="0.0" upper="0.548" velocity="0.5"/>
      <dynamics damping="0.0" friction="0.0"/>
</joint>

by copying code from the _gripper_joint. When running the launch file again it opens RViz and Gazebo with a little wheel controlling interface. In Gazebo everything displays correctly, and I can see the new joint swiwels when I drive R2D2 around. But, in RViz the legs are displayed at the origin and not at the shoulders. This because the TF Transform isn't published. I double checked this using the command rostopic echo /joint_states -n 1, which didn't display the new shoulder joint.


According to the tutorial to get the joint state published you need to add a transmission. So added the transmission like below, again copying from the _gripper_joint.

<joint name="base_to_${prefix}_leg" type="revolute">
      <parent link="base_link"/>
      <child link="${prefix}_leg"/>
      <origin xyz="0 ${reflect*(width+.02)} 0.25" />
      <axis xyz="0 1 0"/>      
      <limit effort="1000.0" lower="0.0" upper="0.548" velocity="0.5"/>
      <dynamics damping="0.0" friction="0.0"/>
</joint>
<transmission name="$base_to_${prefix}_trans">
      <type>transmission_interface/SimpleTransmission</type>
      <actuator name="$base_to_${prefix}_motor">
        <mechanicalReduction>1</mechanicalReduction>
      </actuator>
      <joint name="$base_to_${prefix}_leg">
        <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
      </joint>
</transmission>

This breaks a few things, and I don't understand where I'm going wrong. The symptoms that I see are the following:

  • Gazebo still seems to display the bot correctly, but gripper retracts into the body with no command given. This makes me think that some joints are getting confused.
  • In Gazebo I've lost control of the wheel, which is also why I think some joints are getting confused.
  • In RViz only half of the bot is loaded.
  • Nothing is being published in the /joint_states topic.
  • In the terminal I get the ...
(more)
2020-04-06 11:54:11 -0500 received badge  Scholar (source)
2020-04-06 10:49:02 -0500 received badge  Popular Question (source)
2020-04-06 02:51:07 -0500 asked a question Changing Joint from Fixed to Revolute Breaks TF

Changing Joint from Fixed to Revolute Breaks TF Hello guys, I'm fairly new to ROS and still learning. I've been struggl