Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Pressure topic is not published when add barometric pressure Sensor with geometry_msgs/PointStamped #453

Open
astronaut71 opened this issue Sep 30, 2021 · 0 comments

Comments

@astronaut71
Copy link

Hi

To use http://wiki.ros.org/hector_pose_estimation?distro=noetic hector_pose_estimation package i need to fuse IMU and barometric pressure Sensor with geometry_msgs/PointStamped So I add such barometric pressure Sensor with geometry_msgs/PointStamped with gazebo_ros_plugins.

Here is the urdf.xacro of the barometric pressure Sensor

 <?xml version="1.0"?>
<!-- Copyright (c) 2016 The UUV Simulator Authors.
     All rights reserved.

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">

  <xacro:macro name="no_collision">
    <collision>
      <geometry>
        <cylinder length="${0.000001}" radius="${0.000001}" />
      </geometry>
      <origin xyz="0 0 0" rpy="0 ${0.5*pi} 0"/>
    </collision>
  </xacro:macro>

  <xacro:macro name="default_pressure_macro" params="namespace parent_link *origin">
    <xacro:pressure_plugin_macro
      namespace="${namespace}"
      suffix=""
      parent_link="${parent_link}"
      topic="pressure"
      mass="0.015"
      update_rate="10"
      range="30000"
      noise_sigma="3.0"
      noise_amplitude="0.0"
      estimateDepth="false"
      standardPressure="101.325"
      kPaPerM="9.80638">
      <inertia ixx="0.00001" ixy="0.0" ixz="0.0" iyy="0.00001" iyz="0.0" izz="0.00001" />
      <xacro:insert_block name="origin" />>
    </xacro:pressure_plugin_macro>
  </xacro:macro>

  <xacro:macro name="default_pressure" params="namespace parent_link *origin">
    <xacro:pressure_plugin_macro
      namespace="${namespace}"
      suffix=""
      parent_link="${parent_link}"
      topic="pressure"
      mass="0.015"
      update_rate="10"
      range="30000"
      noise_sigma="3.0"
      noise_amplitude="0.0"
      estimateDepth="false"
      standardPressure="101.325"
      kPaPerM="9.80638">
      <inertia ixx="0.00001" ixy="0.0" ixz="0.0" iyy="0.00001" iyz="0.0" izz="0.00001" />
      <xacro:insert_block name="origin" />
    </xacro:pressure_plugin_macro>
  </xacro:macro>

  <xacro:macro name="pressure_plugin_macro"
    params="namespace suffix parent_link topic mass update_rate
      range noise_sigma noise_amplitude estimateDepth standardPressure kPaPerM
      *inertia *origin">

    <link name="${namespace}/pressure${suffix}_link">
      <inertial>
        <xacro:insert_block name="inertia" />
        <mass value="${mass}" />  <!-- [kg] -->
        <origin xyz="0 0 0" rpy="0 0 0" />
      </inertial>
      <visual>
        <geometry>
          <mesh filename="file://$(find uuv_sensor_ros_plugins)/meshes/pressure.dae" scale="1 1 1"/>
        </geometry>
      </visual>
      <xacro:no_collision/>
    </link>

    <joint name="${namespace}/pressure${suffix}_joint" type="revolute">
      <xacro:insert_block name="origin" />
      <parent link="${parent_link}" />
      <child link="${namespace}/pressure${suffix}_link" />
      <limit upper="0" lower="0" effort="0" velocity="0" />
      <axis xyz="1 0 0"/>
    </joint>

    <gazebo>
      <plugin filename="librotors_gazebo_pressure_plugin.so" name="rotors_gazebo_pressure_sensor${suffix}_plugin">
        <robot_namespace>${namespace}</robot_namespace> <!-- (string, required): ros namespace in which the messages are published -->
        <linkName>${namespace}/pressure${suffix}_link</linkName> <!-- (string, required): name of the body which holds the IMU sensor -->

        <sensor_topic>${topic}</sensor_topic> <!-- (string): name of the sensor output topic and prefix of service names (defaults to imu) -->
        <update_rate>${update_rate}</update_rate> <!-- Update period of accelerometer and gyroscope [s] -->

        <saturation>${range}</saturation> <!-- measurement range [kPa] -->
        <noise_sigma>${noise_sigma}</noise_sigma> <!-- measurement stddev [kPa] -->
        <noise_amplitude>${noise_amplitude}</noise_amplitude>
        <estimate_depth_on>${estimateDepth}</estimate_depth_on> <!-- infer depth? -->
        <standard_pressure>${standardPressure}</standard_pressure> <!-- pressure at sea level (depth 0 m) [kPa] -->
        <kPa_per_meter>${kPaPerM}</kPa_per_meter> <!-- increase in pressure [kPa] per [m] in increased depth -->
        <enable_gazebo_messages>false</enable_gazebo_messages>
      </plugin>
    </gazebo>
  </xacro:macro>

</robot>

It compiles and run it without any error but when run rostopic list the topic is not there. Any help what is the problem?

Thanks

@astronaut71 astronaut71 changed the title Why no topic when add barometric pressure Sensor with geometry_msgs/PointStamped? Why no pressure topic when add barometric pressure Sensor with geometry_msgs/PointStamped? Sep 30, 2021
@astronaut71 astronaut71 changed the title Why no pressure topic when add barometric pressure Sensor with geometry_msgs/PointStamped? Pressure topic is not published when add barometric pressure Sensor with geometry_msgs/PointStamped Sep 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant