0
$\begingroup$

Rosanswers logo

My original package worked well. But after I added a mavlink_interface_macro to my xacro file of the model, I got the following error:

when processing file: /home/u23/WorkSpace/03.fixedwing_sim_pix/04.Firmware/Firmware/Tools/sitl_gazebo/models/techpod/techpod_base.xacro
unknown macro name: xacro:mavlink_interface_macro

when processing file: /home/u23/WorkSpace/03.fixedwing_sim_pix/04.Firmware/Firmware/Tools/sitl_gazebo/models/techpod/techpod_base.xacro

while processing /home/u23/WorkSpace/03.fixedwing_sim_pix/04.Firmware/Firmware/launch/spawn_fixed_wing.launch:

Invalid <param> tag: Cannot load command parameter [robot_description]: command [     /opt/ros/jade/share/xacro/xacro.py '/home/u23/WorkSpace/03.fixedwing_sim_pix/04.Firmware/Firmware/Tools/sitl_gazebo/models/techpod/techpod_base.xacro'     enable_logging:=false     enable_ground_truth:=true     log_file:=techpod     wait_to_record_bag:=false     uav_name:=techpod     namespace:=techpod] returned with code [2]. 

Param xml is <param command="     $(find xacro)/xacro.py '$(arg model)'     enable_logging:=$(arg enable_logging)     enable_ground_truth:=$(arg enable_ground_truth)     log_file:=$(arg log_file)     wait_to_record_bag:=$(arg wait_to_record_bag)     uav_name:=$(arg uav_name)     namespace:=$(arg namespace)" name="robot_description"/>

The traceback for the exception was written to the log file

I checked the xacro file to make sure the mavlink_interface_macro was defined and added in the corrected way. Before I added it the param [robot_description] was also successfully loaded.

I tried some ways I saw from other examples, like:

rosrun xacro xacro my_model_name.xacro > /tmp/old.xml

I got:

Traditional processing is deprecated. Switch to --inorder processing!
To check for compatibility of your document, use option --check-order.
For more infos, see http://wiki.ros.org/xacro#Processing_Order
redefining global property: pi
when processing file: techpod_base.xacro
Undefined substitution argument namespace 
when evaluating expression 'namespace'
when processing file: techpod_base.xacro

However the expression namespace works well when quoted in other macro. I am confused of the relations between the two errors. I checked the log file, which shows:

Invalid <param> tag: Cannot load command parameter [robot_description]: command [     /opt/ros/jade/share/xacro/xacro.py '/home/u23/WorkSpace/03.fixedwing_sim_pix/04.Firmware/Firmware/Tools/sitl_gazebo/models/techpod/techpod_base.xacro'     enable_logging:=false     enable_ground_truth:=true     log_file:=techpod     wait_to_record_bag:=false     uav_name:=techpod     namespace:=techpod] returned with code [2]. 
Param xml is <param command="     $(find xacro)/xacro.py '$(arg model)'     enable_logging:=$(arg enable_logging)     enable_ground_truth:=$(arg enable_ground_truth)     log_file:=$(arg log_file)     wait_to_record_bag:=$(arg wait_to_record_bag)     uav_name:=$(arg uav_name)     namespace:=$(arg namespace)" name="robot_description"/>
[roslaunch][ERROR] 2017-03-11 16:06:37,576: The traceback for the exception was written to the log file
[roslaunch][ERROR] 2017-03-11 16:06:37,577: Traceback (most recent call last):
 File "/opt/ros/jade/lib/python2.7/dist-packages/roslaunch/__init__.py", line 307, in main
    p.start()
 File "/opt/ros/jade/lib/python2.7/dist-packages/roslaunch/parent.py", line 268, in start
    self._start_infrastructure()
 File "/opt/ros/jade/lib/python2.7/dist-packages/roslaunch/parent.py", line 217, in _start_infrastructure
    self._load_config()
File "/opt/ros/jade/lib/python2.7/dist-packages/roslaunch/parent.py", line 132, in _load_config
    roslaunch_strs=self.roslaunch_strs, verbose=self.verbose)
File "/opt/ros/jade/lib/python2.7/dist-packages/roslaunch/config.py", line 453, in load_config_default
                raise RLException(e)
            `RLException: while processing` 
             /home/u23/WorkSpace/03.fixedwing_sim_pix/04.Firmware/Firmware/launch/spawn_fixed_wing.launch:
Invalid <param> tag: Cannot load command parameter [robot_description]: command [`     `/opt/ros/jade/share/xacro/xacro.py '/home/u23/WorkSpace/03.fixedwing_sim_pix/04.Firmware/Firmware/Tools/sitl_ga zebo/models/techpod/techpod_base.xacro'     enable_logging:=false     enable_ground_truth:=true     log_file:=techpod
 wait_to_record_bag:=false     uav_name:=techpod     namespace:=techpod] returned with code [2]. 
     Param xml is <param command="     $(find xacro)/xacro.py '$(arg model)'     enable_logging:=$(arg enable_logging)     enable_ground_truth:=$(arg enable_ground_truth)     log_file:=$(arg log_file)     wait_to_record_bag:=$(arg wait_to_record_bag)     uav_name:=$(arg uav_name)     namespace:=$(arg namespace)" name="robot_description"/>

Could someone give me some instructions? I would be really grateful.

In addition:

Here is the definition of the mavlink_interface_macro in the file component_snippets.xacro:

<xacro:macro name="mavlink_interface_macro"
params="namespace imu_sub_topic motorSpeedCommandPubTopic">
<gazebo>
  <plugin name="rotors_gazebo_mavlink_interface" filename="librotors_gazebo_mavlink_interface.so">
    <robotNamespace>${namespace}</robotNamespace>
  <imuSubTopic>${imu_sub_topic}</imuSubTopic>
  <motorSpeedCommandPubTopic>/gazebo/command/motor_speed</motorSpeedCommandPubTopic>
  </plugin>
</gazebo>

</xacro:macro>

File techpod_base.xacro is the source file with which I spawn the model. In this file I include the former component_snippets.xacro file, and instantiate the mavlink_interface_macro:

<xacro:include filename="$(find rotors_description)/urdf/component_snippets.xacro" />
...
<xacro:mavlink_interface_macro namespace="${namespace}" imu_sub_topic="imu"/>

Originally posted by Yajing_Wang on ROS Answers with karma: 26 on 2017-03-11

Post score: 0


Original comments

Comment by gvdhoorn on 2017-03-11:
Please show your xacro file. Are you xacro:include-ing the correct .xacro file (ie: the one that defines the mavlink_interface_macro macro)?

And ignore the Invalid <param> tag error: as your xacro conversion is failing, the spawner just can't find any urdf in robot_description, so bails.

Comment by Yajing_Wang on 2017-03-11:
Yes. I defined the mavlink_interface_macro macro in file component_snippets.xacro, and included it:

<xacro:include filename="$(find rotors_description)/urdf/component_snippets.xacro" />

I have checked the definition, and I am quite sure it is correct.

Comment by Yajing_Wang on 2017-03-11:
I got your idea of the Invalid <param> tag error. I think there might be something wrong with the configuration of the mavlink_interface plugin which causes the error. I would have a check and try. Thanks for your reply. I would be glad if you can give me more advice.

Comment by gvdhoorn on 2017-03-11:
Can you please edit your original question and add some lines around where you include the xacro, where you instantiate it and where you define it? Barring any sort of unknown bug, this is most likely a typo or some other minor mistake. but without seeing what you're doing we can only guess.

Comment by Yajing_Wang on 2017-03-11:
Sure. Hope I have provided something meaningful.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Finally I found the stupid mistake I have made.

In the instantiation of the macro, I missed the third parameter, since I thought it could load the default value as well.


Originally posted by Yajing_Wang with karma: 26 on 2017-03-13

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.