Hey all,

So I am trying to use the effort_controller/JointVelocityController as a
controller to interface with movegroup action service. In my urdf file I made
sure to set the hardware interface to VelocityJointInterface, and when
creating my RobotHW class I made sure to create a private variable
_hardware_interface::EffortJointInterface jnt_vel_interface;_ in order to
register and connect the interface. Here is my controller.yaml file

atlasarm:

# Trajectory Controllers ---------------------------------------
arm_controller:
type: effort_controllers/JointVelocityController
joints:
\- base_to_azimuth
\- azimuth_to_upperArm
\- upperArm_to_lowerArm
\- lowerArm_to_forward_link
\- forward_link_to_wristlink_1
\- wristlink_1_to_wristlink_2
gains:
base_to_azimuth: {p: 100.0, i: 0.01, d: 10.0}
azimuth_to_upperArm: {p: 100.0, i: 0.01, d: 10.0}
upperArm_to_lowerArm: {p: 100.0, i: 0.01, d: 10.0}
lowerArm_to_forward_link: {p: 100.0, i: 0.01, d: 10.0}
forward_link_to_wristlink_1: {p: 100.0, i: 0.01, d: 10.0}
wristlink_1_to_wristlink_2: {p: 100.0, i: 0.01, d: 10.0}

When I try to run a program using ros_control in order to create/start this
velocity controller I get the following error:

[ERROR] [1404329741.678130586]: No joint given (namespace:
/atlasarm/arm_controller)
[ERROR] [1404329741.678209566]: Failed to initialize the controller
[ERROR] [1404329741.678232210]: Initializing controller
'/atlasarm/arm_controller' failed

Why is it that when I try to load the controller I get this error saying No


< cylinder  >


Reply to author


    // find segment for current timestamp
    TrajectoryPointConstIter start_segment_itr, end_segment_itr;
    const bool valid_point = traj_external_point_ptr_->sample(
      time, interpolation_method_, state_desired_, start_segment_itr, end_segment_itr);


< plugin


< specular  >0.8 0 0 1</  specular  >


</  model  >


Sign in to forward


</  box  >


> How can it be that the process_value sometimes is higher than the velocity
> limit specified in the URDF? This mainly happens, when in the oscillation
> case, where it the arm is actually not moving at all (probably because the
> velocities equalize themselves).
>


> Maybe setting some of these values would help reduce the oscillation and
> help in the PID tuning. However, I don't know what should be set or how we
> could approximate the respective values for our robot. Any good default
> values? Ideas?
>


Forward


Sign in to reply to author


  if (command_joint_names_.empty())
  {
    command_joint_names_ = params_.joints;
    RCLCPP_INFO(
      logger, "No specific joint names are used for command interfaces. Using 'joints' parameter.");
  }
  else if (command_joint_names_.size() != params_.joints.size())
  {
    RCLCPP_ERROR(
      logger, "'command_joints' parameter has to have the same size as 'joints' parameter.");
    return CallbackReturn::FAILURE;
  }


RCLCPP_WARN(get_node()->get_logger(), "Aborted due to state tolerance violation");


< pose  >0 0 10 0 0 0</  pose  >


> > > >
>  For more options, visit [ https://groups.google.com/d/ __ optout
> ](https://groups.google.com/d/optout) .
>


If this flag is set, the controller tries to read the values from the command
interfaces on starting. If they have real numeric values, those will be used
instead of state interfaces. Therefore it is important set command interfaces
to NaN (std::numeric_limits<double>::quiet_NaN()) or state values when the
hardware is started.


  // parse remaining parameters
  const std::string interpolation_string =
    get_node()->get_parameter("interpolation_method").as_string();
  interpolation_method_ = interpolation_methods::from_string(interpolation_string);
  RCLCPP_INFO(
    logger, "Using '%s' interpolation method.",
    interpolation_methods::InterpolationMethodMap.at(interpolation_method_).c_str());


< quadratic  >0.001</  quadratic  >


unread,


</  plugin  >


< linear  >0.01</  linear  >


< initial_position  >0.7854</  initial_position  >


This would be the right way to do it.


You do not have permission to delete messages in this group


</  material  >


</  inertia  >


Default: 0.0 (tolerance is not enforced)


to Felix Meßmer, ros-sig-ro...@googlegroups.com, Michael Francis


Mike,


< joint_name  > j1  </  joint_name  >


  if (params_.joints.empty())
  {
    // TODO(destogl): is this correct? Can we really move-on if no joint names are not provided?
    RCLCPP_WARN(logger, "'joints' parameter is empty.");
  }


< damping  >0.5</  damping  >


xyz {


Letâs set up a new model for this example. A two-linked manipulator arm
which has a total of two joints to control ( [ `
joint_trajectory_controller.sdf ` ](https://github.com/gazebosim/gz-
sim/blob/gz-sim7/examples/worlds/joint_trajectory_controller.sdf) is the
original example). Name it as ` example2.sdf ` .


Either email addresses are anonymous for this group or you need the view
member email addresses permission to view the original message


< i_gain  >0.1</  i_gain  >


< axis  >


> Hey all,
>
>  So I am trying to use the effort_controller/JointVelocityController as a
> controller to interface with movegroup action service. In my urdf file I
> made sure to set the hardware interface to VelocityJointInterface, and when
> creating my RobotHW class I made sure to create a private variable
> _hardware_interface::EffortJointInterface jnt_vel_interface;_ in order to
> register and connect the interface. Here is my controller.yaml file
>


</  visual  >


</  geometry  >


  if (!param_listener_)
  {
    RCLCPP_ERROR(get_node()->get_logger(), "Error encountered during init");
    return controller_interface::CallbackReturn::ERROR;
  }


position {


  // Configure joint position error normalization (angle_wraparound)
  joints_angle_wraparound_.resize(dof_);
  for (size_t i = 0; i < dof_; ++i)
  {
    const auto & gains = params_.gains.joints_map.at(params_.joints[i]);
    if (gains.angle_wraparound)
    {
      // TODO(christophfroehlich): remove this warning in a future release (ROS-J)
      RCLCPP_WARN(
        logger,
        "[Deprecated] Parameter 'gains.<joint>.angle_wraparound' is deprecated. The "
        "angle_wraparound is now used if a continuous joint is configured in the URDF.");
      joints_angle_wraparound_[i] = true;
    }


Oh, two more things, that I cannot explain at the moment:

When I have a look at the process_value entry in the JointVelocityController
state message, this should be the actual/current joint velocity, right?
This value is retrieved directly from the HardwareInterface/GazeboHandle
joint_->getVelocity(),right?
How can it be that the process_value sometimes is higher than the velocity
limit specified in the URDF? This mainly happens, when in the oscillation
case, where it the arm is actually not moving at all (probably because the
velocities equalize themselves).

Similar thing with the efforts.
When looking at the /joint_states/effort[] values, they seem to be correctly
clamped to the effort limit as specified in the URDF.
However, using only one revolute joint (the others fixed) this effort
sometimes is already used up just to keep the joint at velocity 0.
When we now command a velocity in the same direction as the effort (e.g. send
negative velocity in case current effort is -effort_limit), the arm move but
the current effort still is equal to the previous effort value (still
-effort_limit).
How is it possible to move without being allowed to exceed the effort limit?
(I saw that the command value in the state message of the
JointVelocityController has values much higher than the effort limit (which
seems to be ok, as the documentation for SetForce() says that the commanded
effort is truncated to the effort limit).

....Strange things, I cannot explain....


w: 1


Adolfo

Thank you soo much for the link, it really helped me break down the confusion
:). My next question then is if the effort controller is outputing a position
that uses the position error, and velocity error, how can I extract the
velocity error? If possible I would like to continue using the effort
controller and extract the velocity error from the command , so that I can
control the arm using the velocity error. This way i can use velocity to
control the arm and use the position error to determine other factors. Or
should I go another route and use the velocity controller created for the
joint_trajectory_controllers but still not released( [ https://github.com/ros-
controls/ros_controllers/pull/64 ](https://github.com/ros-
controls/ros_controllers/pull/64) )?

Mike


< geometry  >


  // get parameters from the listener in case they were updated
  params_ = param_listener_->get_params();


All controllers will get their update() method called at the same periodic
frequency. For the GazeboRosControlPlugin  plugin, you can set it like so from
the URDF:


nsec: 0


< model  name  =  "background_plane"  >


##  1) JointController


0 new messages


Jul 9, 2014, 2:45:06 PM  7/9/14


< specular  >0.5 0.5 0.5 1</  specular  >


[ ](https://www.google.com.hk/intl/en/about/products?tab=gh)


Use controller in open-loop control mode using ignoring the states provided by
hardware interface and using last commands as states in the next control step.
This is useful if hardware states are not following commands, i.e., an offset
between those (typical for hydraulic manipulators).


< ixx  >0.032</  ixx  >


Copy link


trajectory_msg->joint_names.reserve(dof_);


> > To unsubscribe from this group and stop receiving emails from it, send an
> email to  ros-sig-robot-control+unsub...@googlegroups.com  .


###  Felix Meßmer


~/state (output topic) [control_msgs::msg::JointTrajectoryControllerState]


On Tue, Jul 8, 2014 at 7:53 PM,  < [ mfr...@vt.edu ]() > wrote:


Sign in to forward


sec: 0


</  sphere  >


Reply to author


3) Run the following command to launch the gazebo simulation:


< joint  name  =  "RR_position_control_world"  type  =  "fixed"  >


  // don't update goal after we sampled the trajectory to avoid any racecondition
  const auto active_goal = *rt_active_goal_.readFromRT();


controller_interface::CallbackReturn JointTrajectoryController::on_cleanup(
  const rclcpp_lifecycle::State &)
{
  return CallbackReturn::SUCCESS;
}


    <gazebo>
      <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
        <controlPeriod>0.001</controlPeriod>
      </plugin>
    </gazebo>


< parent  > base_link  </  parent  >


< inertia  >


Either email addresses are anonymous for this group or you need the view
member email addresses permission to view the original message


Show original message


< xyz  >1 0 0</  xyz  >


![Adolfo Rodríguez Tsouroukdissian's profile
photo](https://lh3.googleusercontent.com/a/default-user=s40-c)


You do not have permission to delete messages in this group


            auto result = std::make_shared<FollowJTrajAction::Result>();
            result->set__error_code(FollowJTrajAction::Result::GOAL_TOLERANCE_VIOLATED);
            result->set__error_string(error_string);
            active_goal->setAborted(result);
            // TODO(matthew-reynolds): Need a lock-free write here
            // See https://github.com/ros-controls/ros2_controllers/issues/168
            rt_active_goal_.writeFromNonRT(RealtimeGoalHandlePtr());
            rt_has_pending_goal_.writeFromNonRT(false);


    add_new_trajectory_msg(traj_msg);
    rt_is_holding_.writeFromNonRT(false);
  }


#  joint_trajectory_controller  


< pose  >0.0 0.0 0.0 0 0 0</  pose  >


This is how the model will look:


< material  >


void JointTrajectoryController::read_state_from_state_interfaces(JointTrajectoryPoint & state)
{
  auto assign_point_from_interface =
    [&](std::vector<double> & trajectory_point_interface, const auto & joint_interface)
  {
    for (size_t index = 0; index < dof_; ++index)
    {
      trajectory_point_interface[index] = joint_interface[index].get().get_value();
    }
  };


Sign in to forward


< diffuse  >0.8 0.8 0.8 1</  diffuse  >


unread,


time_from_start {


Maximally allowed tolerance for not reaching the end of the trajectory in a
predefined time.


Report message


    if (has_acceleration_command_interface_)
    {
      joint_command_interface_[2][index].get().set_value(0.0);
    }


filename  =  "gz-sim-joint-controller-system"


< light  type  =  "directional"  name  =  "sun"  >


constraints.goal_time (double)


If there's a load to overcome, like gravity, it makes sense to have a nonzero
effort to keep the joint velocity equal to zero.


< position_i_gain  >0.4</  position_i_gain  >


< d_gain  >0.01</  d_gain  >


     [ Iron (latest) ](../../../../../iron/doc/ros2_controllers/joint_trajectory_controller/doc/userdoc.html)

     [ Humble ](../../../../../humble/doc/ros2_controllers/joint_trajectory_controller/doc/userdoc.html)

     [ Galactic (EOL) ](userdoc.html)

     [ Foxy (EOL) ](../../../../../foxy/doc/ros2_controllers/joint_trajectory_controller/doc/userdoc.html)


</  visual  >


    trajectory_msg->points[index].effort =
      remap(trajectory_msg->points[index].effort, mapping_vector);
  }
}


[ _insert_drive_file_ Tutorials ](tutorials.html) _library_books_ Classes
_toc_ Namespaces  [ _insert_drive_file_ Files ](files.html) [ _launch_ Gazebo
Website ](http://gazebosim.org)


z: 1


< position_d_gain  >1.0</  position_d_gain  >


< axis  >


</  material  >


< geometry  >


</  sdf  >


The trajectory message can be published or subscribed at `
/model/${MODEL_NAME}/joint_trajectory ` by default.


###  mfr...@vt.edu


Jul 4, 2014, 8:30:56 PM  7/4/14


< pose  relative_to  =  "RR_position_control_joint1"  >0 0 0.1 0 0 0</  pose
>


std::shared_ptr<trajectory_msgs::msg::JointTrajectory>
JointTrajectoryController::set_hold_position()
{
  // Command to stay at current position
  hold_position_msg_ptr_->points[0].positions = state_current_.positions;


Either email addresses are anonymous for this group or you need the view
member email addresses permission to view the original message


< material  >


Forward


points {


Delete


Sign in to reply to author


< world  name  =  "default"  >


> > > >
>  For more options, visit [ https://groups.google.com/d/ __ optout
> ](https://groups.google.com/d/optout) .
>


< plugin


parent: "base_link"


< initial_velocity  >1.0</  initial_velocity  >


  return hold_position_msg_ptr_;
}


> > > > To unsubscribe from this group and stop receiving emails from it, send
> an email to  ros-sig-robot-control+ __ unsubscri...@googlegroups.com  .


Values: [position | velocity | acceleration] (multiple allowed)


###  Adolfo Rodríguez Tsouroukdissian


Reply to author


Sign in to report message


Show original message


> Realtime-safe implementation.
>
> Proper handling of wrapping (continuous) joints.
>
> Robust to system clock changes: Discontinuous system clock changes do not
> cause discontinuities in the execution of already queued trajectory
> segments.


> \- Another thing that we recognized is that the JointVelocityController only
> publishes state information only every 10th time update() is called ( [
> https://github.com/ros-controls/ros_controllers/blob/indigo-
> devel/effort_controllers/src/joint_velocity_controller.cpp#L140
> ](https://github.com/ros-controls/ros_controllers/blob/indigo-
> devel/effort_controllers/src/joint_velocity_controller.cpp#L140) ). For our
> initial PIDs the rqt_plots looked quite ok/smooth, but the arm kept dropping
> and was totally unstable. When I then published to the state topic every
> update(), I found the controller heavily oscillating changing sign every
> message. By only publishing every even message, you did not see this...;-)
>


< inertial  >


  auto interface_has_values = [](const auto & joint_interface)
  {
    return std::find_if(
             joint_interface.begin(), joint_interface.end(), [](const auto & interface)
             { return std::isnan(interface.get().get_value()); }) == joint_interface.end();
  };


##  API Reference


< p_gain  >0.2</  p_gain  >


</  geometry  >


[ Sign in
](https://accounts.google.com/ServiceLogin?hl=en&passive=true&continue=https://groups.google.com&ec=GAZA0AM)


< p_gain  >1</  p_gain  >


to Michael Francis, ros-sig-ro...@googlegroups.com


< sdf  version  =  "1.6"  >


Copy link


< model  name  =  "joint_controller_demo"  >


2) Force mode: A user who wants to control joint velocity using a PID
controller can use this mode.


  // Check if a new external message has been received from nonRT threads
  auto current_external_msg = traj_external_point_ptr_->get_trajectory_msg();
  auto new_external_msg = traj_msg_external_point_ptr_.readFromRT();
  // Discard, if a goal is pending but still not active (somewhere stuck in goal_handle_timer_)
  if (
    current_external_msg != *new_external_msg &&
    (*(rt_has_pending_goal_.readFromRT()) && !active_goal) == false)
  {
    fill_partial_goal(*new_external_msg);
    sort_to_local_joint_order(*new_external_msg);
    // TODO(denis): Add here integration of position and velocity
    traj_external_point_ptr_->update(*new_external_msg);
  }


name  =  "gz::sim::systems::JointStatePublisher"  >


  publisher_ = get_node()->create_publisher<ControllerStateMsg>(
    "~/controller_state", rclcpp::SystemDefaultsQoS());
  state_publisher_ = std::make_unique<StatePublisher>(publisher_);


void JointTrajectoryController::publish_state(
  const rclcpp::Time & time, const JointTrajectoryPoint & desired_state,
  const JointTrajectoryPoint & current_state, const JointTrajectoryPoint & state_error)
{
  if (state_publisher_->trylock())
  {
    state_publisher_->msg_.header.stamp = time;
    state_publisher_->msg_.reference.positions = desired_state.positions;
    state_publisher_->msg_.reference.velocities = desired_state.velocities;
    state_publisher_->msg_.reference.accelerations = desired_state.accelerations;
    state_publisher_->msg_.feedback.positions = current_state.positions;
    state_publisher_->msg_.error.positions = state_error.positions;
    if (has_velocity_state_interface_)
    {
      state_publisher_->msg_.feedback.velocities = current_state.velocities;
      state_publisher_->msg_.error.velocities = state_error.velocities;
    }
    if (has_acceleration_state_interface_)
    {
      state_publisher_->msg_.feedback.accelerations = current_state.accelerations;
      state_publisher_->msg_.error.accelerations = state_error.accelerations;
    }
    if (read_commands_from_command_interfaces(command_current_))
    {
      state_publisher_->msg_.output = command_current_;
    }


</  sphere  >


z: 1


< position_i_max  >1</  position_i_max  >


  // Validation of combinations of state and velocity together have to be done
  // here because the parameter validators only deal with each parameter
  // separately.
  if (
    has_velocity_command_interface_ && params_.command_interfaces.size() == 1 &&
    (!has_velocity_state_interface_ || !has_position_state_interface_))
  {
    RCLCPP_ERROR(
      logger,
      "'velocity' command interface can only be used alone if 'velocity' and "
      "'position' state interfaces are present");
    return CallbackReturn::FAILURE;
  }


    if (!urdf_.empty())
    {
      auto urdf_joint = model_.getJoint(params_.joints[i]);
      if (urdf_joint && urdf_joint->type == urdf::Joint::CONTINUOUS)
      {
        RCLCPP_DEBUG(
          logger, "joint '%s' is of type continuous, use angle_wraparound.",
          params_.joints[i].c_str());
        joints_angle_wraparound_[i] = true;
      }
      // do nothing if joint is not found in the URDF
    }
  }


Default: 0.01


  // Handle restart of controller by reading from commands if those are not NaN (a controller was
  // running already)
  trajectory_msgs::msg::JointTrajectoryPoint state;
  resize_joint_trajectory_point(state, dof_);
  if (read_state_from_command_interfaces(state))
  {
    state_current_ = state;
    last_commanded_state_ = state;
  }
  else
  {
    // Initialize current state storage from hardware
    read_state_from_state_interfaces(state_current_);
    read_state_from_state_interfaces(last_commanded_state_);
  }


> Linear: Only position is specified. Guarantees continuity at the position
> level. Discouraged because it yields trajectories with discontinuous
> velocities at the waypoints.
>
> Cubic: Position and velocity are specified. Guarantees continuity at the
> velocity level.
>
> Quintic: Position, velocity and acceleration are specified: Guarantees
> continuity at the acceleration level.


limit_upper: inf


2) Adding the JointTrajectoryController plugin and letâs do position control
for both joints.


</  visual  >


Sign in to forward


unread,


id: 12


< geometry  >


Either email addresses are anonymous for this group or you need the view
member email addresses permission to view the original message


    if (has_velocity_command_interface_)
    {
      joint_command_interface_[1][index].get().set_value(0.0);
    }


![Adolfo Rodríguez Tsouroukdissian's profile
photo](https://lh3.googleusercontent.com/a/default-user=s40-c)


Copy link


Default: 20.0


bool JointTrajectoryController::read_state_from_command_interfaces(JointTrajectoryPoint & state)
{
  bool has_values = true;


cmd[] contains the joint effort to apply in this control cycle. It's not a
relative value. The same applies for position references, they are not
relative.


      for (auto & it : trajectory_msg->points)
      {
        // Assume hold position with 0 velocity and acceleration for missing joints
        if (!it.positions.empty())
        {
          if (
            has_position_command_interface_ &&
            !std::isnan(joint_command_interface_[0][index].get().get_value()))
          {
            // copy last command if cmd interface exists
            it.positions.push_back(joint_command_interface_[0][index].get().get_value());
          }
          else if (has_position_state_interface_)
          {
            // copy current state if state interface exists
            it.positions.push_back(joint_state_interface_[0][index].get().get_value());
          }
        }
        if (!it.velocities.empty())
        {
          it.velocities.push_back(0.0);
        }
        if (!it.accelerations.empty())
        {
          it.accelerations.push_back(0.0);
        }
        if (!it.effort.empty())
        {
          it.effort.push_back(0.0);
        }
      }
    }
  }
}


< cylinder  >


![mfr...@vt.edu's profile photo](//lh3.googleusercontent.com/a-/ALV-
UjXLZw18gFzZHa2C4A0mrLpZ13blWBOpMeCRZ4tYXUaxAYg45w=s40-c)


nsec: 500000000


        // set values for next hardware write()
        if (has_position_command_interface_)
        {
          assign_interface_from_point(joint_command_interface_[0], state_desired_.positions);
        }
        if (has_velocity_command_interface_)
        {
          if (use_closed_loop_pid_adapter_)
          {
            assign_interface_from_point(joint_command_interface_[1], tmp_command_);
          }
          else
          {
            assign_interface_from_point(joint_command_interface_[1], state_desired_.velocities);
          }
        }
        if (has_acceleration_command_interface_)
        {
          assign_interface_from_point(joint_command_interface_[2], state_desired_.accelerations);
        }
        if (has_effort_command_interface_)
        {
          assign_interface_from_point(joint_command_interface_[3], tmp_command_);
        }


void JointTrajectoryController::sort_to_local_joint_order(
  std::shared_ptr<trajectory_msgs::msg::JointTrajectory> trajectory_msg) const
{
  // rearrange all points in the trajectory message based on mapping
  std::vector<size_t> mapping_vector = mapping(trajectory_msg->joint_names, params_.joints);
  auto remap = [this](
                 const std::vector<double> & to_remap,
                 const std::vector<size_t> & mapping) -> std::vector<double>
  {
    if (to_remap.empty())
    {
      return to_remap;
    }
    if (to_remap.size() != mapping.size())
    {
      RCLCPP_WARN(
        get_node()->get_logger(), "Invalid input size (%zu) for sorting", to_remap.size());
      return to_remap;
    }
    static std::vector<double> output(dof_, 0.0);
    // Only resize if necessary since it's an expensive operation
    if (output.size() != mapping.size())
    {
      output.resize(mapping.size(), 0.0);
    }
    for (size_t index = 0; index < mapping.size(); ++index)
    {
      auto map_index = mapping[index];
      output[map_index] = to_remap[index];
    }
    return output;
  };


< joint_name  > j1  </  joint_name  >


You do not have permission to delete messages in this group


**Note** : This force mode is for the user who is looking to manually tune PID
gains for velocity control according to a specific use case (e.g. Custom
models). For general testing purposes, velocity mode will give the best
results.


</  world  >


action_monitor_rate (double):


</  box  >


< ixz  >0</  ixz  >


  * ` set_hold_position ` means
    * position command interface: set the current position as command
    * velocity (open loop), acceleration command interface: set command to zero
    * command interface velocity + effort in closed loop: position control on current position
  * Deactivation:
    * position command interface: set the current position as command
    * velocity + effort command interface: set zero
  * Tests ensuring this behavior
This should fix
  * [ JTC does not stop velocity command after goal succeed  #469  ](https://github.com/ros-controls/ros2_controllers/issues/469)
  * [ JointTrajectoryController fails to hold position on effort control  #514  ](https://github.com/ros-controls/ros2_controllers/issues/514)
  * [ [JTC] set_hold_position() doesn't actually stop the robot  #683  ](https://github.com/ros-controls/ros2_controllers/issues/683)
Sorry, something went wrong.
👍  1  bmagyar reacted with thumbs up emoji
All reactions
  * 👍  1 reaction
[ ![@c-rizz](https://avatars.githubusercontent.com/u/5949904?s=40&v=4)
](/c-rizz) [
![@christophfroehlich](https://avatars.githubusercontent.com/u/3367244?s=40&v=4)
](/christophfroehlich)
` [ Explicitly set hold position ](/ros-
controls/ros2_controllers/pull/558/commits/e31510116c2452e48aacb4891e066c4e56688734
"Explicitly set hold position
\(cherry picked from commit bbc13b2743a64f76fbca90d0b7fc59a66b3c53b1\)") ` …
` [ e315101 ](/ros-
controls/ros2_controllers/pull/558/commits/e31510116c2452e48aacb4891e066c4e56688734)
`

    (cherry picked from commit [bbc13b2](https://github.com/christophfroehlich/ros2_controllers/commit/bbc13b2743a64f76fbca90d0b7fc59a66b3c53b1))
[ ![@github-actions](https://avatars.githubusercontent.com/in/15368?s=40&v=4)
](/apps/github-actions) [ github-actions ](/apps/github-actions) bot
requested review from [ anfemosa  ](/anfemosa) , [ bmagyar  ](/bmagyar) , [
destogl  ](/destogl) , [ homalozoa  ](/homalozoa) , [ mcbed  ](/mcbed) , [
peterdavidfagan  ](/peterdavidfagan) and [ progtologist  ](/progtologist)
March 31, 2023 19:09
[
![@christophfroehlich](https://avatars.githubusercontent.com/u/3367244?s=40&u=98db36351213b952b1c6ce663c1fde4108272539&v=4)
](/christophfroehlich) [ christophfroehlich ](/christophfroehlich) marked this
as a duplicate of [ #531 ](/ros-controls/ros2_controllers/pull/531 "JTC:


< xyz  >0 0 1</  xyz  >


This would look almost the same as velocity mode if PID gains are tuned
properly.


name: "j1"


< position_p_gain  >20</  position_p_gain  >


< size  >0.5 0.5 0.01</  size  >


cd gz_turtorial


Help


###  Adolfo Rodríguez Tsouroukdissian


On Fri, Jul 11, 2014 at 4:57 PM,  < [ mfr...@vt.edu ]() > wrote:


child: "rotor"


</  material  >


< inertial  >


  using namespace std::placeholders;
  action_server_ = rclcpp_action::create_server<FollowJTrajAction>(
    get_node()->get_node_base_interface(), get_node()->get_node_clock_interface(),
    get_node()->get_node_logging_interface(), get_node()->get_node_waitables_interface(),
    std::string(get_node()->get_name()) + "/follow_joint_trajectory",
    std::bind(&JointTrajectoryController::goal_received_callback, this, _1, _2),
    std::bind(&JointTrajectoryController::goal_cancelled_callback, this, _1),
    std::bind(&JointTrajectoryController::goal_accepted_callback, this, _1));


The controller is templated to work with multiple trajectory representations.
By default, a spline interpolator is provided, but it’s possible to support
other representations. The spline interpolator uses the following
interpolation strategies depending on the waypoint specification:


< specular  >0.5 0.5 0.5 1</  specular  >


Sign in to forward


bool JointTrajectoryController::has_active_trajectory() const
{
  return traj_external_point_ptr_ != nullptr && traj_external_point_ptr_->has_trajectory_msg();
}


[
![@christophfroehlich](https://avatars.githubusercontent.com/u/3367244?s=40&u=98db36351213b952b1c6ce663c1fde4108272539&v=4)
](/christophfroehlich) [ christophfroehlich ](/christophfroehlich) mentioned
this pull request  May 14, 2023
[ [JTC] Tolerance tests + Hold on time violation  #613  ](/ros-
controls/ros2_controllers/pull/613)
Merged
1 task
[
![@christophfroehlich](https://avatars.githubusercontent.com/u/3367244?s=40&v=4)
](/christophfroehlich)
` [ [JTC] Extend tests ( ](/ros-
controls/ros2_controllers/pull/558/commits/42b25908adbfc15c15710425949c6258c02a6065
"\[JTC\] Extend tests \(#612\)") [ ros-controls#612 ](https://github.com/ros-
controls/ros2_controllers/pull/612) [ ) ](/ros-
controls/ros2_controllers/pull/558/commits/42b25908adbfc15c15710425949c6258c02a6065
"\[JTC\] Extend tests \(#612\)") `
` [ 42b2590 ](/ros-
controls/ros2_controllers/pull/558/commits/42b25908adbfc15c15710425949c6258c02a6065)
`
[
![@christophfroehlich](https://avatars.githubusercontent.com/u/3367244?s=40&u=98db36351213b952b1c6ce663c1fde4108272539&v=4)
](/christophfroehlich) [ christophfroehlich ](/christophfroehlich) mentioned
this pull request  Jun 25, 2023
[ Have set_hold_position() actually stop the robot  #684  ](/ros-
controls/ros2_controllers/pull/684)
Closed
6 tasks
[
![@christophfroehlich](https://avatars.githubusercontent.com/u/3367244?s=40&v=4)
](/christophfroehlich)
` [ Increase action tests timeout ( ](/ros-
controls/ros2_controllers/pull/558/commits/fd89df56e253501088c436ab16162464cec33822
"Increase action tests timeout \(#680\)") [ ros-controls#680
](https://github.com/ros-controls/ros2_controllers/pull/680) [ ) ](/ros-
controls/ros2_controllers/pull/558/commits/fd89df56e253501088c436ab16162464cec33822
"Increase action tests timeout \(#680\)") `
` [ fd89df5 ](/ros-
controls/ros2_controllers/pull/558/commits/fd89df56e253501088c436ab16162464cec33822)
`


  // currently carrying out a trajectory
  if (has_active_trajectory())
  {
    bool first_sample = false;
    // if sampling the first time, set the point before you sample
    if (!traj_external_point_ptr_->is_sampled_already())
    {
      first_sample = true;
      if (params_.open_loop_control)
      {
        traj_external_point_ptr_->set_point_before_trajectory_msg(
          time, last_commanded_state_, joints_angle_wraparound_);
      }
      else
      {
        traj_external_point_ptr_->set_point_before_trajectory_msg(
          time, state_current_, joints_angle_wraparound_);
      }
    }


Maximally allowed deviation from the target trajectory for a given joint.


< joint_name  > RR_position_control_joint2  </  joint_name  >


unread,


to Michael Francis, ros-sig-ro...@googlegroups.com


Sign in to reply to author


Thanks for the comments,

it seems that we are able to find (more or less) good/satisfying PIDs for all
separate joint respectively following the approach mentioned above.
However, as soon as we allow several joints to be revolute again at the same
time, The behaviour is bad again - as Adolfo already expected for the obvious
reasons.
We again see highly oscillating values in the joint controllers changing the
sign evey update cycle.

Some things that we are currently thinking about:
\- As we do not know realistic values for damping, friction and so on, so far,
we tried to use default values (or simply remove the respective tags from the
URDF or the gazebo extension XACRO). In fact, we currently only set the
<matrial> in the gazebo extension and use damping=0 and friction=0 in the
URDF. (Friction is not implemented in Gazebo anyway, isn't it?)
Maybe setting some of these values would help reduce the oscillation and help
in the PID tuning. However, I don't know what should be set or how we could
approximate the respective values for our robot. Any good default values?
Ideas?

\- We also have had the <safety_controller> tag in our URDF. There were values
for k_p and k_v, where I don't know where they come from. When I removed the
tag, the controller seems to behave (at least a bit) better. Any counter-
arguments against removing this tag from the URDF?

\- Is it possible that a slower update frequency for the
JointVelocityController might help the problem? Is this update frequency
parameterizable? Where can I set it? I think the default is the gazebo tick
rate, isn't it?

@Adolfo:
Can you elaborate a bit more on what frequency-domain tools you were using? Do
you mean Bode-Diagram and stuff like that?
So you have a mathematical model for your hardware, right?

Best,
Felix


sec: 0


[ ![Logo](../../../../_static/logo_ros-controls.png) ](../../../../index.html)


Sign in to report message


parent: "base_link"


</  inertia  >


< pose  >-0.1 0 0 0 1.5708 0</  pose  >


Other Versions  v: galactic


< position_cmd_min  >-20</  position_cmd_min  >


Report message


position: 35.115896338490096


Either email addresses are anonymous for this group or you need the view
member email addresses permission to view the original message


filename  =  "gz-sim-joint-controller-system"


One can change the joint velocity by publishing a message on the topic `
/model/joint_controller_demo/joint/j1/cmd_vel ` or can change the topic name
within the plugin.


Show original message


* Sending velocity commands


</  collision  >


This file should answer your question,

[ https://github.com/ros-controls/ros_controllers/blob/indigo-
devel/joint_trajectory_controller/include/joint_trajectory_controller/hardware_interface_adapter.h
](https://github.com/ros-controls/ros_controllers/blob/indigo-
devel/joint_trajectory_controller/include/joint_trajectory_controller/hardware_interface_adapter.h)


< length  >0.2</  length  >


  state_publisher_->lock();
  state_publisher_->msg_.joint_names = params_.joints;
  state_publisher_->msg_.reference.positions.resize(dof_);
  state_publisher_->msg_.reference.velocities.resize(dof_);
  state_publisher_->msg_.reference.accelerations.resize(dof_);
  state_publisher_->msg_.feedback.positions.resize(dof_);
  state_publisher_->msg_.error.positions.resize(dof_);
  if (has_velocity_state_interface_)
  {
    state_publisher_->msg_.feedback.velocities.resize(dof_);
    state_publisher_->msg_.error.velocities.resize(dof_);
  }
  if (has_acceleration_state_interface_)
  {
    state_publisher_->msg_.feedback.accelerations.resize(dof_);
    state_publisher_->msg_.error.accelerations.resize(dof_);
  }
  if (has_position_command_interface_)
  {
    state_publisher_->msg_.output.positions.resize(dof_);
  }
  if (has_velocity_command_interface_)
  {
    state_publisher_->msg_.output.velocities.resize(dof_);
  }
  if (has_acceleration_command_interface_)
  {
    state_publisher_->msg_.output.accelerations.resize(dof_);
  }
  if (has_effort_command_interface_)
  {
    state_publisher_->msg_.output.effort.resize(dof_);
  }


< model  name  =  "RR_position_control"  >


gz sim -v 4 -r example2.sdf


limit_upper: inf


###  Details about parameters  


< visual  name  =  "RR_position_control_link1_visual_0"  >


< joint  name  =  "RR_position_control_joint1"  type  =  "revolute"  >


testing the old version of JTC. Could you give it a try with [ this manual
cherrypick
](https://github.com/christophfroehlich/ros2_controllers/tree/backport558)
please?

---

👍  1  BarisYazici reacted with thumbs up emoji
All reactions
  * 👍  1 reaction
Sorry, something went wrong.
[
![@BarisYazici](https://avatars.githubusercontent.com/u/11574709?s=80&u=69837dbce7c726a585a9e0bea0b38baa9626ba83&v=4)
](/BarisYazici)
Copy link
###
**[ BarisYazici ](/BarisYazici) ** commented  Sep 18, 2023
> This PR hasn't been backported to humble yet, which means you were still
> testing the old version of JTC. Could you give it a try with [ this manual
> cherrypick
> ](https://github.com/christophfroehlich/ros2_controllers/tree/backport558)
> please?
You are right, my mistake. I tested it, and it works as expected. We will
remove the old JTC from our repo in the next update.

---

❤  1  destogl reacted with heart emoji
All reactions
  * ❤  1 reaction
Sorry, something went wrong.
[
![@christophfroehlich](https://avatars.githubusercontent.com/u/3367244?s=80&u=98db36351213b952b1c6ce663c1fde4108272539&v=4)
](/christophfroehlich)
Copy link
Contributor  Author
###
**[ christophfroehlich ](/christophfroehlich) ** commented  Sep 18, 2023
thanks for the feedback


  * [ ](../../../../index.html)
  * [ ros2_controllers ](../../doc/controllers_index.html)
  * joint_trajectory_controller
  * [ Edit on GitHub ](https://github.com/ros-controls/control.ros.org/blob/galactic//doc/ros2_controllers/joint_trajectory_controller/doc/userdoc.rst)


> > > > To unsubscribe from this group and stop receiving emails from it, send
> an email to  ros-sig-robot-control+ __ unsubscri...@googlegroups.com  .


</  geometry  >


< scene  >


**Description:** Arbitrary elements and attributes that can be used to
configure the plugin  ](spec?ver=1.11&elem=sensor#plugin_)


#####  <depth_camera> Element


#####  <stddev> Element


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the correlation time in seconds of the
noise used to drive a process to model slow variations in a sensor bias. A
typical value, when used, would be on the order of 3600 seconds (1 hour).
](spec?ver=1.11&elem=sensor#noise_dynamic_bias_correlation_time)


* [ humble ](/questions/scope:all/sort:activity-desc/tags:humble/page:1/)


#####  <c3> Element


**Required:** 0
**Type:**
**Default:**
**Description:** Noise parameters for vertical position
](spec?ver=1.11&elem=sensor#altimeter_vertical_position)


#####  <x> Element


#####  <velocity_sensing> Element


void  |  [ Update
](classgazebo_1_1sensors_1_1Sensor.html#a523c36734a3eca17f44ebed440a5ca5e)
(const bool _force)
|  Update the sensor.  More...

double  |  [ UpdateRate
](classgazebo_1_1sensors_1_1Sensor.html#a4d59a3eef146815eb0f1738d62c9b71b) ()
const
|  Get the update rate of the sensor.  More...

bool  |  [ Visualize
](classgazebo_1_1sensors_1_1Sensor.html#ae95f1e1369ecd6a92d32f3c4ad609477) ()
const
|  Return true if user requests the sensor to be visualized via tag:
<visualize>true</visualize> in SDF.  More...

std::string  |  [ WorldName
](classgazebo_1_1sensors_1_1Sensor.html#a8d915bdc60c548778a2f28d6cbfc7107) ()
const
|  Returns the name of the world the sensor is in.  More...

##  Protected Member Functions

---
virtual void  |  [ Fini
](classgazebo_1_1sensors_1_1ImuSensor.html#a2cab2318072218e46466d00af0345fed)
()
|  Finalize the sensor.  More...

void  |  [ Load
](classgazebo_1_1sensors_1_1ImuSensor.html#a12ec81ef650fa927cea852db56db939e)
(const std::string &_worldName, sdf::ElementPtr _sdf)
|  Load the sensor with SDF parameters.  More...

virtual void  |  [ Load
](classgazebo_1_1sensors_1_1ImuSensor.html#a59498969e3e295cdd4631fa193c0dfd0)
(const std::string &_worldName)
|  Load the sensor with default parameters.  More...


|  virtual void Init  |  (  |  |  )  |
---|---|---|---|---
virtual

Initialize the IMU.


[ **updated 2022-08-18 19:30:19 -0500  ** ](/questions/405106/revisions/)


#####  <anti_aliasing> Element


but it is not a ros issue .


[ List ](classes.html)


Parameters


ROS Resources: [ Documentation ](http://wiki.ros.org/) | [ Support
](http://wiki.ros.org/Support) | [ Discussion Forum
](http://discourse.ros.org/) | [ Index ](http://index.ros.org/) | [ Service
Status ](http://status.ros.org/) | [ ros @ Robotics Stack Exchange
](https://robotics.stackexchange.com/questions/tagged/ros)
---

_Attention:_ Answers.ros.org is deprecated as of August the 11th, 2023. Please
visit [ robotics.stackexchange.com ](http://robotics.stackexchange.com) to ask
a new question. This site will remain online in read-only mode during the
transition and into the foreseeable future. Selected questions and answers
have been migrated, and redirects have been put in place to direct users to
the corresponding questions on Robotics Stack Exchange. Additional details are
[ available here ](https://discourse.ros.org/t/ros-and-gazebo-answers-
migration-to-robotics-stack-exchange-process/31494) .


#####  <frequency> Element


#####  <far> Element


**Required:** 0
**Type:** bool
**Default:** false
**Description:** If true the sensor will always be updated according to the
update rate.  ](spec?ver=1.11&elem=sensor#sensor_always_on)


#####  <dynamic_bias_stddev> Element


#####  <custom_rpy> Element


**Required:** 1
**Type:** double
**Default:** 0
**Description:** Must be greater or equal to min_angle
](spec?ver=1.11&elem=sensor#vertical_max_angle)


Type of sensor.


#####  <gain> Element


Toggle navigation  [
![SDFormat](/assets/masthead-b37cf3cb82b2656194c11c6120206e7f8e47bc590261084df67a4f092fa92ddb.png)
](/)


**Required:** 1
**Type:** string
**Default:** none
**Description:** The type of noise. Currently supported types are: "none" (no
noise). "gaussian" (draw noise values independently for each measurement from
a Gaussian distribution). "gaussian_quantized" ("gaussian" plus quantization
of outputs (ie. rounding))  ](spec?ver=1.11&elem=sensor#noise_type)


The sensor's ID.


#####  <precision> Element


#####  <enable_orientation> Element


[ ![Robotics010 gravatar image](/m/default/media/images/nophoto.png?v=27)
](/users/12336/robotics010/) [ Robotics010 ](/users/12336/robotics010/) (
2022-08-18 19:32:55 -0500  )  edit


**Required:** 1
**Type:** double
**Default:** 160
**Description:** X principal point (in pixels)
](spec?ver=1.11&elem=sensor#intrinsics_cx)


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the mean of the Gaussian distribution
from which noise values are drawn.  ](spec?ver=1.11&elem=sensor#noise_mean)


**Required:** 0
**Type:**
**Default:**
**Description:** These elements are specific to the IMU sensor.
](spec?ver=1.11&elem=sensor#sensor_imu)


**Required:** 1
**Type:**
**Default:**
**Description:** The properties of a sensor noise model.
](spec?ver=1.11&elem=sensor#y_noise)


|  ignition::math::Pose3d pose
---
protected  inherited

Pose of the sensor.


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the standard deviation of the Gaussian
distribution from which bias values are drawn.
](spec?ver=1.11&elem=sensor#noise_bias_stddev)


**Required:** 0
**Type:**
**Default:**
**Description:** The properties of the noise model that should be applied to
generated scans  ](spec?ver=1.11&elem=sensor#lidar_noise)


But still I'd say that fixed to robot's body imu sensor must not fall down.
Why is it happening anyway and how to fix it properly? Is it gazebo bug and I
should update gazebo with the newer patched version?


**Required:** 0
**Type:**
**Default:**
**Description:** These elements are specific to the contact sensor.
](spec?ver=1.11&elem=sensor#sensor_contact)


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the standard deviation of the noise
used to drive a process to model slow variations in a sensor bias.
](spec?ver=1.11&elem=sensor#noise_dynamic_bias_stddev)


**Parent element:** <link> or <joint>
**Notes:** A link and joint may contain many sensors.


#####  <bias_stddev> Element


#####  <camera_info_topic> Element


#####  <localization> Element


#####  <update_rate> Element


**Required:** 0
**Type:**
**Default:**
**Description:** Noise parameters for the pressure data.
](spec?ver=1.11&elem=sensor#air_speed_pressure)


|  std::map< [ SensorNoiseType
](namespacegazebo_1_1sensors.html#a8569effcecad158424f2c50f24e93433) , [
NoisePtr ](namespacegazebo_1_1sensors.html#a63589b4b647df1e01e9f2e5e30c95be1)
> noises
---
protected  inherited

[ Noise ](classgazebo_1_1sensors_1_1Noise.html "Noise models for sensor output
signals. ") added to sensor data.


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian_quantized", the precision of output
signals. A value of zero implies infinite precision / no quantization.
](spec?ver=1.11&elem=sensor#noise_precision)


**Required:** 1
**Type:**
**Default:**
**Description:** The properties of a sensor noise model.
](spec?ver=1.11&elem=sensor#horizontal_noise)


Parameters


void SetReferencePose  |  (  |  |  )  |
---|---|---|---|---

Sets the current IMU pose as the reference NED pose, i.e.


**Required:** 0
**Type:** string
**Default:** R8G8B8
**Description:**
(L8|L16|R_FLOAT16|R_FLOAT32|R8G8B8|B8G8R8|BAYER_RGGB8|BAYER_BGGR8|BAYER_GBRG8|BAYER_GRBG8)
](spec?ver=1.11&elem=sensor#image_format)


**Required:** 1
**Type:**
**Default:**
**Description:** The near and far clip planes. Objects closer or farther than
these planes are not rendered.  ](spec?ver=1.11&elem=sensor#camera_clip)


[ bt_navigator failing with error `Action server failed while executing action
callback: "send_goal failed"` ](/question/383678/bt_navigator-failing-with-
error-action-server-failed-while-executing-action-callback-send_goal-failed/)


Follow


#####  <dynamic_bias_stddev> Element


Angular velocity.


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the mean of the Gaussian distribution
from which bias values are drawn.
](spec?ver=1.11&elem=sensor#noise_bias_mean)


#####  <logical_camera> Element


**Required:** 1
**Type:** double
**Default:** 0
**Description:** Minimum range  ](spec?ver=1.11&elem=sensor#sonar_min)


#####  <resolution> Element


#####  <always_on> Element


|  std::vector< [ event::ConnectionPtr
](namespacegazebo_1_1event.html#a2d370e7ba9de036fe110e1f94a982773) >
connections
---
protected  inherited

All event connections.


#####  type  Attribute


#####  <stddev> Element


**Required:** 0
**Type:**
**Default:**
**Description:** ](spec?ver=1.11&elem=sensor#sensor_rfidtag)


**Required:** 0
**Type:**
**Default:**
**Description:** These elements are specific to the ray (laser) sensor.
](spec?ver=1.11&elem=sensor#sensor_ray)


**Required:** 1
**Type:** double
**Default:** 0
**Description:** The minimum distance for each lidar ray.
](spec?ver=1.11&elem=sensor#range_min)


**Required:** 0
**Type:** unsigned int
**Default:** 4294967295
**Description:** Visibility mask of a camera. When (camera's visibility_mask &
visual's visibility_flags) evaluates to non-zero, the visual will be visible
to the camera.  ](spec?ver=1.11&elem=sensor#camera_visibility_mask)


     [in]  |  _noiseFree  |  True if the returned measurement should not use noise.
---|---|---

Returns


#####  <precision> Element


**Required:** 1
**Type:**
**Default:**
**Description:** The properties of a sensor noise model.
](spec?ver=1.11&elem=sensor#x_noise)


#####  <type> Element


#####  <noise> Element


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the correlation time in seconds of the
noise used to drive a process to model slow variations in a sensor bias. A
typical value, when used, would be on the order of 3600 seconds (1 hour).
](spec?ver=1.11&elem=sensor#noise_dynamic_bias_correlation_time)


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian," the standard deviation of the Gaussian
distribution from which noise values are drawn.
](spec?ver=1.11&elem=sensor#noise_stddev)


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the standard deviation of the Gaussian
distribution from which noise values are drawn.
](spec?ver=1.11&elem=sensor#noise_stddev)


#####  <bias_mean> Element


**Required:** 1
**Type:** double
**Default:** 0
**Description:** ](spec?ver=1.11&elem=sensor#vertical_min_angle)


#####  <rfidtag> Element


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the mean of the Gaussian distribution
from which noise values are drawn.  ](spec?ver=1.11&elem=sensor#noise_mean)


True if active, false if not.


|  virtual bool IsActive  |  (  |  |  )  |  const
---|---|---|---|---
virtual

Returns true if sensor generation is active.


|  std::vector< [ SensorPluginPtr
](namespacegazebo.html#a2b599e6301975e0b70bfaaf50d49aa9e) > plugins
---
protected  inherited

All the plugins for the sensor.


#####  <p_fy> Element


[ ALL ](/questions/scope:all/sort:activity-desc/page:1/) [ UNANSWERED
](/questions/scope:unanswered/sort:answers-asc/page:1/)


add a comment


#####  <k2> Element


Class


#####  <dynamic_bias_stddev> Element


#####  <z> Element


#####  type  Attribute


**Required:** 0
**Type:** double
**Default:** 10
**Description:** Far clipping plane for depth camera
](spec?ver=1.11&elem=sensor#clip_far)


**Required:** 1
**Type:** double
**Default:** 0
**Description:** The minimum distance for each ray.
](spec?ver=1.11&elem=sensor#range_min)


     [in]  |  _sdf  |  SDF [ Sensor ](classgazebo_1_1sensors_1_1Sensor.html "Base class for sensors. ") parameters.
---|---|---
[in]  |  _worldName  |  Name of world to load from.

Reimplemented from [ Sensor
](classgazebo_1_1sensors_1_1Sensor.html#a53e2a5858da79f16235ca1c5c89fc337) .


#####  <visualize> Element


**Required:** 0
**Type:**
**Default:**
**Description:** These elements are specific to an air speed sensor. This
sensor determines speed based on the differential between static and dynamic
pressure.  ](spec?ver=1.11&elem=sensor#sensor_air_speed)


**Required:** 1
**Type:**
**Default:**
**Description:** The properties of a sensor noise model.
](spec?ver=1.11&elem=sensor#vertical_velocity_noise)


[ subscribe to rss feed ](/feeds/question/405106/ "subscribe to the rss feed")


Reimplemented from [ gazebo::sensors::Sensor
](classgazebo_1_1sensors_1_1Sensor.html#ada830b34821503027125af9b0744a295) .


|  virtual void SetActive  |  (  |  const bool  |  __value_ |  )  |
---|---|---|---|---|---
virtual  inherited

Set whether the sensor is active or not.


#####  <topic> Element


**Required:** 1
**Type:**
**Default:**
**Description:** The properties of a sensor noise model.
](spec?ver=1.11&elem=sensor#x_noise)


#####  <noise> Element


**Required:** 0
**Type:** string
**Default:** child
**Description:** Frame in which to report the wrench values. Currently
supported frames are: "parent" report the wrench expressed in the orientation
of the parent link frame, "child" report the wrench expressed in the
orientation of the child link frame, "sensor" report the wrench expressed in
the orientation of the joint sensor frame. Note that for each option the point
with respect to which the torque component of the wrench is expressed is the
joint origin.  ](spec?ver=1.11&elem=sensor#force_torque_frame)


#####  <bias_mean> Element


#####  <s> Element


Public Member Functions  |  Protected Member Functions  | [ List of all
members ](classgazebo_1_1sensors_1_1ImuSensor-members.html)


Sort by »  [ oldest  ](/question/405106/gazebo-imu-sensor-is-falling-down-in-
nav2-getting-started-example/?sort=oldest#sort-top) [ newest
](/question/405106/gazebo-imu-sensor-is-falling-down-in-nav2-getting-started-
example/?sort=latest#sort-top) [ most voted  ](/question/405106/gazebo-imu-
sensor-is-falling-down-in-nav2-getting-started-example/?sort=votes#sort-top)


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the standard deviation of the noise
used to drive a process to model slow variations in a sensor bias.
](spec?ver=1.11&elem=sensor#noise_dynamic_bias_stddev)


#####  <near> Element


bool  |  [ NeedsUpdate
](classgazebo_1_1sensors_1_1Sensor.html#a854d4f8ec541aea9d5fbf9ba88466087) ()
|  Return true if the sensor needs to be updated.  More...

virtual bool  |  [ UpdateImpl
](classgazebo_1_1sensors_1_1ImuSensor.html#aa5f8654f6ebfca1e0478ce895208940c)
(const bool _force)
|  This gets overwritten by derived sensor types.  More...

##  Protected Attributes

---
bool  |  [ active
](classgazebo_1_1sensors_1_1Sensor.html#a03c996f9fcf0e10baeb3e700be0c409a)
|  True if sensor generation is active.  More...

std::vector< [ event::ConnectionPtr
](namespacegazebo_1_1event.html#a2d370e7ba9de036fe110e1f94a982773) > |  [
connections
](classgazebo_1_1sensors_1_1Sensor.html#a33ef6bb267d1d3a87f1f0ce32abef23e)
|  All event connections.  More...

[ common::Time ](classgazebo_1_1common_1_1Time.html) |  [ lastMeasurementTime
](classgazebo_1_1sensors_1_1Sensor.html#a28ac23662e917882845c549d1473d00c)
|  Stores last time that a sensor measurement was generated; this value must
be updated within each sensor's UpdateImpl.  More...

[ common::Time ](classgazebo_1_1common_1_1Time.html) |  [ lastUpdateTime
](classgazebo_1_1sensors_1_1Sensor.html#aa835ad9578c02d5c9284d8d4737543a5)
|  Time of the last update.  More...

[ transport::NodePtr
](namespacegazebo_1_1transport.html#ae54bb65ed6e30aae97dc1dc067c530b2) |  [
node
](classgazebo_1_1sensors_1_1Sensor.html#a5ec599e8941bb7eb085cf6cbf2fe456e)
|  Node for communication.  More...

ignition::transport::Node  |  [ nodeIgn
](classgazebo_1_1sensors_1_1Sensor.html#a6ed17b0914a22bdab5ae8c87f7a9d2c6)


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the standard deviation of the Gaussian
distribution from which noise values are drawn.
](spec?ver=1.11&elem=sensor#noise_stddev)


**Required:** 0
**Type:**
**Default:**
**Description:** The sensor tag describes the type and properties of a sensor.
](spec?ver=1.11&elem=sensor#link_sensor)


#####  <bias_stddev> Element


Parameters


try to add ..


#####  <k3> Element


**Required:** 1
**Type:**
**Default:**
**Description:** The properties of a sensor noise model.
](spec?ver=1.11&elem=sensor#horizontal_noise)


The sensor's parent's ID.


#####  degrees  Attribute


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the mean of the Gaussian distribution
from which noise values are drawn.  ](spec?ver=1.11&elem=sensor#noise_mean)


**Required:** 0
**Type:**
**Default:**
**Description:** Parameters related to GPS position measurement.
](spec?ver=1.11&elem=sensor#gps_position_sensing)


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the standard deviation of the Gaussian
distribution from which bias values are drawn.
](spec?ver=1.11&elem=sensor#noise_bias_stddev)


Returns


#####  <optical_frame_id> Element


_hz update rate of sensor. Returns 0 if unthrottled.


**Required:** 0
**Type:** double
**Default:** 1
**Description:** Angle scaling constant
](spec?ver=1.11&elem=sensor#custom_function_c2)


#####  <triggered> Element


     [in]  |  _subscriber  |  Callback that receives the signal.
---|---|---

Returns


#####  <p_cx> Element


#####  type  Attribute


#####  <c1> Element


Reimplemented from [ gazebo::sensors::Sensor
](classgazebo_1_1sensors_1_1Sensor.html#ac79e415efcc4c205bba2e56d40a6c327) .


sdf::ElementPtr  |  [ sdf
](classgazebo_1_1sensors_1_1Sensor.html#a74eda2ef621a1c1198b19d95c3ad3da8)
|  Pointer the the SDF element for the sensor.  More...

[ common::Time ](classgazebo_1_1common_1_1Time.html) |  [ updatePeriod
](classgazebo_1_1sensors_1_1Sensor.html#a4d6194c6bf89279b2d7aae0e2f7dee81)
|  Desired time between updates, set indirectly by [ Sensor::SetUpdateRate
](classgazebo_1_1sensors_1_1Sensor.html#a2be83a9017389ebe8e88d43bcd928648 "Set
the update rate of the sensor. ") .  More...

[ gazebo::physics::WorldPtr
](namespacegazebo_1_1physics.html#aec14fc3b768b02f40b019ef9791e15f2) |  [
world
](classgazebo_1_1sensors_1_1Sensor.html#a3dde2c0fabd6d23369d4b57f375b3f87)
|  Pointer to the world.  More...

##  Detailed Description


#####  <bias_stddev> Element


**Required:** 0
**Type:**
**Default:**
**Description:** These elements are specific to logical camera sensors. A
logical camera reports objects that fall within a frustum. Computation should
be performed on the CPU.  ](spec?ver=1.11&elem=sensor#sensor_logical_camera)


[ ![Robotics010 gravatar image](/m/default/media/images/nophoto.png?v=27)
](/users/12336/robotics010/)


#####  <noise> Element


**Required:** 1
**Type:** double
**Default:** 0
**Description:** Must be greater or equal to min_angle
](spec?ver=1.11&elem=sensor#vertical_max_angle)


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the correlation time in seconds of the
noise used to drive a process to model slow variations in a sensor bias. A
typical value, when used, would be on the order of 3600 seconds (1 hour).
](spec?ver=1.11&elem=sensor#noise_dynamic_bias_correlation_time)


Class


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the mean of the Gaussian distribution
from which bias values are drawn.
](spec?ver=1.11&elem=sensor#noise_bias_mean)


#####  Elements


Returns


**Required:** 0
**Type:**
**Default:**
**Description:** These elements are specific to a wireless transceiver.
](spec?ver=1.11&elem=sensor#sensor_transceiver)


#####  <bias_mean> Element


#####  <precision> Element


#####  <dynamic_bias_stddev> Element


#####  <vertical> Element


#####  <dynamic_bias_correlation_time> Element


#####  <k1> Element


#####  <max_angle> Element


#####  <horizontal> Element


**Required:** 1
**Type:**
**Default:**
**Description:** The properties of a sensor noise model.
](spec?ver=1.11&elem=sensor#y_noise)


#####  <stddev> Element


**Required:** 0
**Type:** string
**Default:** __default__
**Description:** Name of the topic on which data is published. This is
necessary for visualization  ](spec?ver=1.11&elem=sensor#sensor_topic)


#####  <gps> Element


#####  <mean> Element


     [out]  |  _msg  |  Message to fill.
---|---|---

|  virtual void Fini  |  (  |  |  )  |
---|---|---|---|---
protected  virtual

Finalize the sensor.


**Required:** 0
**Type:** string
**Default:** cone
**Description:** The sonar collision shape. Currently supported geometries
are: "cone" and "sphere".  ](spec?ver=1.11&elem=sensor#sonar_geometry)


#####  <noise> Element


void gazebo::sensors::ImuSensor::SetReferencePose  |  (  |  |  )  |
---|---|---|---|---

Sets the current pose as the IMU reference pose.


#####  <position_sensing> Element


#####  <collision> Element


An IMU sensor. [ More... ](classgazebo_1_1sensors_1_1ImuSensor.html#details)


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the mean of the Gaussian distribution
from which noise values are drawn.  ](spec?ver=1.11&elem=sensor#noise_mean)


     [ List ](classes.html)
     [ Hierarchy ](hierarchy.html)


**Required:** 0
**Type:** double
**Default:** 0
**Description:** The radial distortion coefficient k2
](spec?ver=1.11&elem=sensor#distortion_k2)


[ Hi there! Please sign in ](/account/signin/?next=/question/405106/gazebo-
imu-sensor-is-falling-down-in-nav2-getting-started-example/) [ help ](/help/
"help")


#####  <precision> Element


      z: -0.034367962884921444
    linear_acceleration_covariance:
    - 0.00028900000000000003
    - 0.0
    - 0.0
    - 0.0
    - 0.00028900000000000003
    - 0.0
    - 0.0
    - 0.0
    - 0.00028900000000000003
    ---


**Required:** 0
**Type:**
**Default:**
**Description:** These elements are specific to an altimeter sensor.
](spec?ver=1.11&elem=sensor#sensor_altimeter)


[ SetPose() ](classgazebo_1_1sensors_1_1Sensor.html#a8c2db08c71f7336337638d692016a7c3 "Set the current pose. ")


#####  <bias_stddev> Element


**Required:** 1
**Type:** string
**Default:** none
**Description:** The type of noise. Currently supported types are: "none" (no
noise). "gaussian" (draw noise values independently for each measurement from
a Gaussian distribution). "gaussian_quantized" ("gaussian" plus quantization
of outputs (ie. rounding))  ](spec?ver=1.11&elem=sensor#noise_type)


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the mean of the Gaussian distribution
from which bias values are drawn.
](spec?ver=1.11&elem=sensor#noise_bias_mean)


**Required:** 0
**Type:**
**Default:**
**Description:** ](spec?ver=1.11&elem=sensor#sensor_rfid)


#####  type  Attribute


|  [ NoisePtr
](namespacegazebo_1_1sensors.html#a63589b4b647df1e01e9f2e5e30c95be1) [ Noise
](classgazebo_1_1sensors_1_1Noise.html) |  (  |  const [ SensorNoiseType
](namespacegazebo_1_1sensors.html#a8569effcecad158424f2c50f24e93433) |
__type_ |  )  |  const
---|---|---|---|---|---
inherited

Get the sensor's noise model for a specified noise type.


Parameters


#####  <dynamic_bias_stddev> Element


#####  <stddev> Element


**Required:** 1
**Type:**
**Default:**
**Description:** The properties of a sensor noise model.
](spec?ver=1.11&elem=sensor#pressure_noise)


|  virtual void gazebo::sensors::ImuSensor::Load  |  (  |  const std::string &
|  __worldName_ |  )  |
---|---|---|---|---|---
protected  virtual

Load the sensor with default parameters.


#####  <sensitivity> Element


**Required:** 0
**Type:** double
**Default:** 160
**Description:** X principal point for projection matrix(in pixels, overrides
cx)  ](spec?ver=1.11&elem=sensor#projection_p_cx)


**Required:** 0
**Type:**
**Default:**
**Description:** Parameters related to the body-frame X axis of the
magnetometer  ](spec?ver=1.11&elem=sensor#magnetometer_x)


  if (element)
  {
    if (element->HasElement("gz_frame_id"))
    {
      this->frame_id = element->Get<std::string>("gz_frame_id");
    }
    else
    {
      // TODO(ahcorde): Remove this deprecation in gz-sensors8
      if (element->HasElement("ignition_frame_id"))
      {
        gzwarn << "The `ignition_frame_id` tag is deprecated. "
               << "Please use `gz_frame_id` instead." << std::endl;
        this->frame_id = element->Get<std::string>("ignition_frame_id");
      }
      else
      {
        this->frame_id = this->name;
      }
    }
  }
  // Try resolving the pose first, and only use the raw pose if that fails
  auto semPose = _sdf.SemanticPose();
  sdf::Errors errors = semPose.Resolve(this->pose);
  if (!errors.empty())
  {
    this->pose = _sdf.RawPose();
  }
  this->sdfUpdateRate = this->updateRate = _sdf.UpdateRate();
  this->enableMetrics = _sdf.EnableMetrics();
  return true;
}
//////////////////////////////////////////////////
Sensor::Sensor() :
  dataPtr(new SensorPrivate)
{
  this->dataPtr->id = (++this->dataPtr->idCounter);
}
//////////////////////////////////////////////////
bool Sensor::Init()


#####  <bias_mean> Element


Reimplemented from [ Sensor
](classgazebo_1_1sensors_1_1Sensor.html#af65e6e5fcb133ff2e95dc6d76e9616cb) .


**Required:** 1
**Type:** double
**Default:** 0
**Description:** ](spec?ver=1.11&elem=sensor#vertical_min_angle)


|  Ignition transport node.  More...

std::map< [ SensorNoiseType
](namespacegazebo_1_1sensors.html#a8569effcecad158424f2c50f24e93433) ,
[ NoisePtr
](namespacegazebo_1_1sensors.html#a63589b4b647df1e01e9f2e5e30c95be1) > |  [
noises
](classgazebo_1_1sensors_1_1Sensor.html#a988ed81eaf965106ed5cab57f5bf5c7b)
|  [ Noise ](classgazebo_1_1sensors_1_1Noise.html "Noise models for sensor
output signals. ") added to sensor data.  More...

uint32_t  |  [ parentId
](classgazebo_1_1sensors_1_1Sensor.html#ab064e68233bb7ac9ca2ca33080ef5770)
|  The sensor's parent ID.  More...

std::string  |  [ parentName
](classgazebo_1_1sensors_1_1Sensor.html#a94ac364d10883e621704a6d94d83c6f3)
|  Name of the parent.  More...

std::vector< [ SensorPluginPtr
](namespacegazebo.html#a2b599e6301975e0b70bfaaf50d49aa9e) > |  [ plugins
](classgazebo_1_1sensors_1_1Sensor.html#ae30df31f30686f25b07f100aadc56d31)
|  All the plugins for the sensor.  More...

ignition::math::Pose3d  |  [ pose
](classgazebo_1_1sensors_1_1Sensor.html#a0fa0526f60dd0d221e37f32ccc43ff3a)
|  Pose of the sensor.  More...

[ gazebo::rendering::ScenePtr
](namespacegazebo_1_1rendering.html#afb4d94a778b7dfb146de03d1830ed8bb) |  [
scene
](classgazebo_1_1sensors_1_1Sensor.html#ac874619cab29c4a45271e3ec3161ccbb)
|  Pointer to the Scene.  More...

sdf::ElementPtr  |  [ sdf
](classgazebo_1_1sensors_1_1Sensor.html#a9c8890e3cbc9ca72b1d308f3576d95e3)
|  Pointer the the SDF element for the sensor.  More...

[ common::Time ](classgazebo_1_1common_1_1Time.html) |  [ updatePeriod
](classgazebo_1_1sensors_1_1Sensor.html#a7ee23b2581372282f845ecb7b72c62b0)


#####  <vertical> Element


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the correlation time in seconds of the
noise used to drive a process to model slow variations in a sensor bias. A
typical value, when used, would be on the order of 3600 seconds (1 hour).
](spec?ver=1.11&elem=sensor#noise_dynamic_bias_correlation_time)


**Required:** 0
**Type:**
**Default:**
**Description:** Noise parameters for vertical position measurement, in units
of meters.  ](spec?ver=1.11&elem=sensor#position_sensing_vertical)


**Required:** 1
**Type:**
**Default:**
**Description:** The properties of a sensor noise model.
](spec?ver=1.11&elem=sensor#horizontal_noise)


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the standard deviation of the Gaussian
distribution from which noise values are drawn.
](spec?ver=1.11&elem=sensor#noise_stddev)


|  ignition::transport::Node nodeIgn
---
protected  inherited

Ignition transport node.


#####  <enable_metrics> Element


#####  <bias_stddev> Element


#####  type  Attribute


Thanks iimata! Your workaround has resolved the issue. Imu sensor is not
falling down anymore and /imu message returns expected 9.81
linear_acceleration.z value.


    <?xml version="1.0" ?>
    <sdf version="1.5">
      <model name="box">
        <link name="link">

            <sensor type="camera" name="my_sensor">
              <camera>
                <horizontal_fov>1.047</horizontal_fov>
                <image>
                  <width>320</width>
                  <height>240</height>
                </image>
                <clip>
                  <near>0.1</near>
                  <far>100</far>
                </clip>
              </camera>
              <always_on>1</always_on>
              <update_rate>30</update_rate>
              <visualize>true</visualize>
            </sensor>

        </link>
      </model>
    </sdf>


Seen: **511 times**


#####  <intrinsics> Element


**Required:** 0
**Type:** pose
**Default:** 0 0 0 0 0 0
**Description:** A pose (translation, rotation) expressed in the frame named
by @relative_to. The first three components (x, y, z) represent the position
of the element's origin (in the @relative_to frame). The rotation component
represents the orientation of the element as either a sequence of Euler
rotations (r, p, y), see http://sdformat.org/tutorials?tut=specify_pose, or as
a quaternion (x, y, z, w), where w is the real component.
](spec?ver=1.11&elem=sensor#sensor_pose)


**Required:** 1
**Type:**
**Default:**
**Description:** The properties of a sensor noise model.
](spec?ver=1.11&elem=sensor#y_noise)


#####  <bias_mean> Element


#####  <dynamic_bias_correlation_time> Element


|  [ common::Time ](classgazebo_1_1common_1_1Time.html) LastUpdateTime  |  (
|  |  )  |  const
---|---|---|---|---
inherited

Return last update time.


**Required:** 1
**Type:** double
**Default:** 1
**Description:** Horizontal field of view of the frustum, in radians. This is
the angle between the frustum's vertex and the edges of the near or far plane.
](spec?ver=1.11&elem=sensor#logical_camera_horizontal_fov)


#####  <trigger_topic> Element


|  sdf::ElementPtr sdf
---
protected  inherited

Pointer the the SDF element for the sensor.


**Required:** 1
**Type:** double
**Default:** 0
**Description:** Near clipping distance of the view frustum
](spec?ver=1.11&elem=sensor#logical_camera_near)


**Required:** 1
**Type:**
**Default:**
**Description:** The properties of a sensor noise model.
](spec?ver=1.11&elem=sensor#z_noise)


**Required:** 1
**Type:** string
**Default:** none
**Description:** The type of noise. Currently supported types are: "none" (no
noise). "gaussian" (draw noise values independently for each measurement from
a Gaussian distribution). "gaussian_quantized" ("gaussian" plus quantization
of outputs (ie. rounding))  ](spec?ver=1.11&elem=sensor#noise_type)


**Required:** 0
**Type:**
**Default:**
**Description:** These elements are specific to the sonar sensor.
](spec?ver=1.11&elem=sensor#sensor_sonar)


[ ![Robotics010 gravatar image](/m/default/media/images/nophoto.png?v=27)
](/users/12336/robotics010/) [ Robotics010 ](/users/12336/robotics010/) (
2022-08-19 07:35:43 -0500  )  edit


* [ ImuSensor.hh ](ImuSensor_8hh_source.html)


#####  <noise> Element


[ ![cc-by-sa](/m/default/media/images/cc-by-sa.png?v=28)
](http://creativecommons.org/licenses/by-sa/3.0/legalcode) ROS Answers is
licensed under Creative Commons Attribution 3.0 Content on this site is
licensed under a [ Creative Commons Attribution Share Alike 3.0
](http://creativecommons.org/licenses/by-sa/3.0/legalcode) license.


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the mean of the Gaussian distribution
from which bias values are drawn.
](spec?ver=1.11&elem=sensor#noise_bias_mean)


A pointer to the connection. This must be kept in scope.


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the correlation time in seconds of the
noise used to drive a process to model slow variations in a sensor bias. A
typical value, when used, would be on the order of 3600 seconds (1 hour).
](spec?ver=1.11&elem=sensor#noise_dynamic_bias_correlation_time)


gazebo::sensors::ImuSensor Class Reference


SDFormat is open-source licensed under [ Apache 2.0
](http://www.apache.org/licenses/LICENSE-2.0.html)


**Required:** 1
**Type:** string
**Default:** tan
**Description:** Possible values are 'sin', 'tan' and 'id'
](spec?ver=1.11&elem=sensor#custom_function_fun)


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian_quantized", the precision of output
signals. A value of zero implies infinite precision / no quantization.
](spec?ver=1.11&elem=sensor#noise_precision)


#####  <pose> Element


|  virtual void gazebo::sensors::ImuSensor::Fini  |  (  |  |  )  |
---|---|---|---|---
protected  virtual

Finalize the sensor.


**Required:** 0
**Type:** vector3
**Default:** 1 0 0
**Description:** Used when localization is set to GRAV_UP or GRAV_DOWN, a
projection of this vector into a plane that is orthogonal to the gravity
vector defines the direction of the IMU reference frame's X-axis. grav_dir_x
is defined in the coordinate frame as defined by the parent_frame element.
](spec?ver=1.11&elem=sensor#orientation_reference_frame_grav_dir_x)


**Required:** 0
**Type:**
**Default:**
**Description:** Force about the Y axis  ](spec?ver=1.11&elem=sensor#torque_y)


     [in]  |  _sdf  |  SDF [ Sensor ](classgazebo_1_1sensors_1_1Sensor.html "Base class for sensors. ") parameters.
---|---|---
[in]  |  _worldName  |  Name of world to load from.

Reimplemented from [ gazebo::sensors::Sensor
](classgazebo_1_1sensors_1_1Sensor.html#ad7753586983649b879d74e60357a442b) .


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the standard deviation of the noise
used to drive a process to model slow variations in a sensor bias.
](spec?ver=1.11&elem=sensor#noise_dynamic_bias_stddev)


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the standard deviation of the Gaussian
distribution from which noise values are drawn.
](spec?ver=1.11&elem=sensor#noise_stddev)


#####  <c2> Element


|  double UpdateRate  |  (  |  |  )  |  const
---|---|---|---|---
inherited

Get the update rate of the sensor.


**Required:** 1
**Type:** double
**Default:** 277
**Description:** X focal length (in pixels, overrides horizontal_fov)
](spec?ver=1.11&elem=sensor#intrinsics_fx)


     [in]  |  _force  |  True if update is forced, false if not
---|---|---

Returns


ignition::math::Vector3d LinearAcceleration  |  (  |  const bool  |
__noiseFree_ = ` false ` |  )  |  const
---|---|---|---|---|---

Returns the imu linear acceleration in the IMU sensor local frame.


#####  <resolution> Element


|  std::string WorldName  |  (  |  |  )  |  const
---|---|---|---|---
inherited

Returns the name of the world the sensor is in.


**Required:** 0
**Type:** bool
**Default:** false
**Description:** If true, the sensor is visualized in the GUI
](spec?ver=1.11&elem=sensor#sensor_visualize)


**Required:** 1
**Type:** double
**Default:** 120
**Description:** Y principal point (in pixels)
](spec?ver=1.11&elem=sensor#intrinsics_cy)


**Required:** 1
**Type:** double
**Default:** 0
**Description:** ](spec?ver=1.11&elem=sensor#horizontal_min_angle)


#####  <bias_stddev> Element


#####  type  Attribute


#####  <pose> Element


#####  <geometry> Element


#####  <dynamic_bias_correlation_time> Element


**Required:** 0
**Type:** double
**Default:** 0
**Description:** X translation for projection matrix (in pixels)
](spec?ver=1.11&elem=sensor#projection_tx)


**Required:** 0
**Type:**
**Default:**
**Description:** ](spec?ver=1.11&elem=sensor#imu_orientation_reference_frame)


` #include < [ sensors/sensors.hh ](ImuSensor_8hh_source.html) > `


**Required:** 1
**Type:**
**Default:**
**Description:** The properties of a sensor noise model.
](spec?ver=1.11&elem=sensor#z_noise)


#####  <output> Element


**Required:** 0
**Type:** bool
**Default:** false
**Description:** Whether or not the euler angles are in degrees, otherwise
they will be interpreted as radians by default.
](spec?ver=1.11&elem=sensor#pose_degrees)


Parameters


**Required:** 0
**Type:**
**Default:**
**Description:** Camera intrinsic parameters for setting a custom perspective
projection matrix (cannot be used with WideAngleCamera since this class uses
image stitching from 6 different cameras for achieving a wide field of view).
The focal lengths can be computed using focal_length_in_pixels =
(image_width_in_pixels * 0.5) / tan(field_of_view_in_degrees * 0.5 * PI/180)
](spec?ver=1.11&elem=sensor#lens_intrinsics)


#####  <fx> Element


#####  <navsat> Element


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the standard deviation of the Gaussian
distribution from which bias values are drawn.
](spec?ver=1.11&elem=sensor#noise_bias_stddev)


**Required:** 0
**Type:**
**Default:**
**Description:** Linear acceleration about the X axis
](spec?ver=1.11&elem=sensor#linear_acceleration_x)


  * [ gazebo ](namespacegazebo.html)
  * [ sensors ](namespacegazebo_1_1sensors.html)
  * [ ImuSensor ](classgazebo_1_1sensors_1_1ImuSensor.html)


**Required:** 1
**Type:**
**Default:**
**Description:** ](spec?ver=1.11&elem=sensor#scan_horizontal)


#####  <mean> Element


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the correlation time in seconds of the
noise used to drive a process to model slow variations in a sensor bias. A
typical value, when used, would be on the order of 3600 seconds (1 hour).
](spec?ver=1.11&elem=sensor#noise_dynamic_bias_correlation_time)


#####  <env_texture_size> Element


#####  <z> Element


Name of Parent.


**Required:** 1
**Type:** string
**Default:** __default__
**Description:** name of the collision element within a link that acts as the
contact sensor.  ](spec?ver=1.11&elem=sensor#contact_collision)


First time here? Check out the FAQ!


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the mean of the Gaussian distribution
from which noise values are drawn.  ](spec?ver=1.11&elem=sensor#noise_mean)


#####  <stddev> Element


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the standard deviation of the noise
used to drive a process to model slow variations in a sensor bias.
](spec?ver=1.11&elem=sensor#noise_dynamic_bias_stddev)


Returns


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian_quantized", the precision of output
signals. A value of zero implies infinite precision / no quantization.
](spec?ver=1.11&elem=sensor#noise_precision)


#####  <y> Element


#####  <noise> Element


**Required:** 1
**Type:** string
**Default:** none
**Description:** The type of noise. Currently supported types are: "none" (no
noise). "gaussian" (draw noise values independently for each measurement from
a Gaussian distribution). "gaussian_quantized" ("gaussian" plus quantization
of outputs (ie. rounding))  ](spec?ver=1.11&elem=sensor#noise_type)


tb3 config is the same as Nav2 tutorials has the following:


**Required:** 0
**Type:** double
**Default:** 1.5707
**Description:** Everything outside of the specified angle will be hidden, 90°
by default  ](spec?ver=1.11&elem=sensor#lens_cutoff_angle)


![image description](/upfiles/16606639759631048.png)


**Required:** 1
**Type:**
**Default:**
**Description:** The properties of a sensor noise model.
](spec?ver=1.11&elem=sensor#x_noise)


|  virtual ~ [ ImuSensor ](classgazebo_1_1sensors_1_1ImuSensor.html) |  (  |
|  )  |
---|---|---|---|---
virtual

Destructor.


#####  <bias_mean> Element


#####  <scale_to_hfov> Element


#####  <range> Element


**Required:** 0
**Type:** double
**Default:** 277
**Description:** X focal length for projection matrix(in pixels, overrides fx)
](spec?ver=1.11&elem=sensor#projection_p_fx)


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the mean of the Gaussian distribution
from which bias values are drawn.
](spec?ver=1.11&elem=sensor#noise_bias_mean)


|  void FillMsg  |  (  |  msgs::Sensor & |  __msg_ |  )  |
---|---|---|---|---|---
inherited

fills a msgs::Sensor message.


[ ![iimata gravatar image](/upfiles/avatars/iimata/resized/16/BB8-robot-Star-
Wars_1024x768.jpg) ](/users/101281/iimata/) [ iimata ](/users/101281/iimata/)
(  2022-08-19 07:18:30 -0500  )  edit


**Required:** 0
**Type:**
**Default:**
**Description:** Noise parameters for horizontal position measurement, in
units of meters.  ](spec?ver=1.11&elem=sensor#position_sensing_horizontal)


**Required:** 0
**Type:** double
**Default:** 1
**Description:** Focal length of the optical system. Note: It's not a focal
length of the lens in a common sense! This value is ignored if 'scale_to_fov'
is set to true  ](spec?ver=1.11&elem=sensor#custom_function_f)


**Required:** 0
**Type:**
**Default:**
**Description:** These elements are specific to body-frame angular velocity,
which is expressed in radians per second
](spec?ver=1.11&elem=sensor#imu_angular_velocity)


#####  <projection> Element


#####  <precision> Element


Returns


**Required:** 1
**Type:** unsigned int
**Default:** 1
**Description:** The number of simulated lidar rays to generate per complete
laser sweep cycle.  ](spec?ver=1.11&elem=sensor#vertical_samples)


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the standard deviation of the Gaussian
distribution from which noise values are drawn.
](spec?ver=1.11&elem=sensor#noise_stddev)


1 follower


**Required:** 0
**Type:**
**Default:**
**Description:** Noise parameters for horizontal velocity measurement, in
units of meters/second.
](spec?ver=1.11&elem=sensor#velocity_sensing_horizontal)


gazebo imu sensor is falling down in Nav2 getting started example


|  std::string parentName
---
protected  inherited

Name of the parent.


#####  parent_frame  Attribute


#####  <dynamic_bias_stddev> Element


  /// \brief Transport node.
  public: gz::transport::Node node;
  /// \brief Publishes the PerformanceSensorMetrics message.
  public: gz::transport::Node::Publisher performanceSensorMetricsPub;
  /// \brief SDF element with sensor information.
  public: sdf::ElementPtr sdf = nullptr;
  /// \brief SDF Sensor DOM object.
  public: sdf::Sensor sdfSensor;
  /// \brief Sequence numbers that are used in sensor data message headers.
  /// A map is used so that a single sensor can have multiple sensor
  /// streams each with a sequence counter.
  public: std::map<std::string, uint64_t> sequences;
  /// \brief frame id
  public: std::string frame_id;
  /// \brief If sensor is active or not.
  public: bool active = true;
};
SensorId SensorPrivate::idCounter = 0;
//////////////////////////////////////////////////
bool SensorPrivate::PopulateFromSDF(const sdf::Sensor &_sdf)
{
  this->sdfSensor = _sdf;
  // All SDF code gets auto converted to latest version. This code is
  // written assuming sdformat 1.7 is the latest
  // \todo(nkoenig) what to do with <always_on>? SDFormat docs seem
  // to say if true
  //  then the update_rate will be obeyed. Gazebo seems to use it as if
  //  true means enable the sensor at startup.
  // \todo(nkoenig) what to do with <visualize>? gz-sensor data is meant to
  // create
  // sensor data. Whether or not that data should be visualized seems to
  // be outside the scope of this library
  // \todo(nkoenig) how to use frame?
  this->name = _sdf.Name();
  if (!_sdf.Topic().empty())
  {
    if (!this->SetTopic(_sdf.Topic()))
      return false;
  }
  sdf::ElementPtr element = _sdf.Element();


#####  <bias_mean> Element


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the standard deviation of the Gaussian
distribution from which bias values are drawn.
](spec?ver=1.11&elem=sensor#noise_bias_stddev)


#####  <mean> Element


#####  <fy> Element


#####  type  Attribute


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the correlation time in seconds of the
noise used to drive a process to model slow variations in a sensor bias. A
typical value, when used, would be on the order of 3600 seconds (1 hour).
](spec?ver=1.11&elem=sensor#noise_dynamic_bias_correlation_time)


**Required:** 0
**Type:**
**Default:**
**Description:** Torque about the X axis
](spec?ver=1.11&elem=sensor#torque_x)


#####  <precision> Element


#####  <noise> Element


**Required:** 1
**Type:** double
**Default:** 0
**Description:** ](spec?ver=1.11&elem=sensor#horizontal_min_angle)


     [in]  |  _value  |  True if active, false if not.
---|---|---

|  void SetParent  |  (  |  const std::string & |  __name_ ,
---|---|---|---
|  |  const uint32_t  |  __id_
|  )  |  |
inherited

Set the sensor's parent.


**Required:** 1
**Type:** string
**Default:** none
**Description:** The type of noise. Currently supported types are: "none" (no
noise). "gaussian" (draw noise values independently for each measurement from
a Gaussian distribution). "gaussian_quantized" ("gaussian" plus quantization
of outputs (ie. rounding))  ](spec?ver=1.11&elem=sensor#noise_type)


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the standard deviation of the noise
used to drive a process to model slow variations in a sensor bias.
](spec?ver=1.11&elem=sensor#noise_dynamic_bias_stddev)


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the mean of the Gaussian distribution
from which noise values are drawn.  ](spec?ver=1.11&elem=sensor#noise_mean)


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian_quantized", the precision of output
signals. A value of zero implies infinite precision / no quantization.
](spec?ver=1.11&elem=sensor#noise_precision)


#####  <near> Element


#####  <stddev> Element


See Also


|  [ event::ConnectionPtr
](namespacegazebo_1_1event.html#a2d370e7ba9de036fe110e1f94a982773)
ConnectUpdated  |  (  |  std::function< void()> |  __subscriber_ |  )  |
---|---|---|---|---|---
inherited

Connect a signal that is triggered when the sensor is updated.


[ How to use WS2812B LED lights with ROS 2 node ](/question/414293/how-to-use-
ws2812b-led-lights-with-ros-2-node/)


Public Member Functions  |  Protected Member Functions  |  Protected
Attributes  | [ List of all members ](classgazebo_1_1sensors_1_1ImuSensor-
members.html)


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the mean of the Gaussian distribution
from which bias values are drawn.
](spec?ver=1.11&elem=sensor#noise_bias_mean)


#####  type  Attribute


#####  <dynamic_bias_correlation_time> Element


**Required:** 1
**Type:** string
**Default:** CUSTOM
**Description:** This string represents special hardcoded use cases that are
commonly seen with typical robot IMU's: - CUSTOM: use Euler angle custom_rpy
orientation specification. The orientation of the IMU's reference frame is
defined by adding the custom_rpy rotation to the parent_frame. - NED: The IMU
XYZ aligns with NED, where NED orientation relative to Gazebo world is defined
by the SphericalCoordinates class. - ENU: The IMU XYZ aligns with ENU, where
ENU orientation relative to Gazebo world is defined by the
SphericalCoordinates class. - NWU: The IMU XYZ aligns with NWU, where NWU
orientation relative to Gazebo world is defined by the SphericalCoordinates
class. - GRAV_UP: where direction of gravity maps to IMU reference frame
Z-axis with Z-axis pointing in the opposite direction of gravity. IMU
reference frame X-axis direction is defined by grav_dir_x. Note if grav_dir_x
is parallel to gravity direction, this configuration fails. Otherwise, IMU
reference frame X-axis is defined by projection of grav_dir_x onto a plane
normal to the gravity vector. IMU reference frame Y-axis is a vector
orthogonal to both X and Z axis following the right hand rule. - GRAV_DOWN:
where direction of gravity maps to IMU reference frame Z-axis with Z-axis
pointing in the direction of gravity. IMU reference frame X-axis direction is
defined by grav_dir_x. Note if grav_dir_x is parallel to gravity direction,
this configuration fails. Otherwise, IMU reference frame X-axis is defined by
projection of grav_dir_x onto a plane normal to the gravity vector. IMU
reference frame Y-axis is a vector orthogonal to both X and Z axis following
the right hand rule.
](spec?ver=1.11&elem=sensor#orientation_reference_frame_localization)


**Required:** 0
**Type:**
**Default:**
**Description:** The near and far clip planes. Objects closer or farther than
these planes are not detected by the depth camera.
](spec?ver=1.11&elem=sensor#depth_camera_clip)


#####  <resolution> Element


#####  <precision> Element


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the standard deviation of the Gaussian
distribution from which noise values are drawn.
](spec?ver=1.11&elem=sensor#noise_stddev)


#####  <bias_stddev> Element


**Required:** 0
**Type:**
**Default:**
**Description:** Parameters related to GPS position measurement.
](spec?ver=1.11&elem=sensor#gps_velocity_sensing)


#####  <mean> Element


  * both URDF and SDF data in [ sam_bot_description.urdf ](https://github.com/ros-planning/navigation2_tutorials/blob/master/sam_bot_description/src/description/sam_bot_description.urdf) file
  * launch file [ display.launch.py ](https://github.com/ros-planning/navigation2_tutorials/blob/master/sam_bot_description/launch/display.launch.py)


|  [ gazebo::physics::WorldPtr
](namespacegazebo_1_1physics.html#ac3c64bcc94673efe731c498c8421e1db) world
---
protected  inherited

Pointer to the world.


#####  <ty> Element


|  uint32_t Id  |  (  |  |  )  |  const
---|---|---|---|---
inherited

Get the sensor's ID.


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the correlation time in seconds of the
noise used to drive a process to model slow variations in a sensor bias. A
typical value, when used, would be on the order of 3600 seconds (1 hour).
](spec?ver=1.11&elem=sensor#noise_dynamic_bias_correlation_time)


Returns


**Required:** 1
**Type:** bool
**Default:** true
**Description:** If true the image will be scaled to fit horizontal FOV,
otherwise it will be shown according to projection type parameters
](spec?ver=1.11&elem=sensor#lens_scale_to_hfov)


#####  <height> Element


edit


**Required:** 0
**Type:** double
**Default:** -90
**Description:** Mininum received signal power in dBm
](spec?ver=1.11&elem=sensor#transceiver_sensitivity)


[ Modules ](modules.html)


#####  <far> Element


|  virtual gazebo::sensors::ImuSensor::~ImuSensor  |  (  |  |  )  |
---|---|---|---|---
virtual

Destructor.


[ ![ljaniec gravatar
image](/upfiles/avatars/ljaniec/resized/16/61P0tF0vnZL._AC_SY355_.jpg)
](/users/63587/ljaniec/) [ ljaniec ](/users/63587/ljaniec/) (  2022-08-19
08:28:25 -0500  )  edit


In comparison here is a sample of sam_bot imu data (got from [ First-Time
Robot Setup Guide - Setting Up Odometry - Adding Gazebo Plugins to a URDF
](https://navigation.ros.org/setup_guides/odom/setup_odom.html#adding-gazebo-
plugins-to-a-urdf) ) (look at linear_acceleration.z value, it is about
expected 9.81 value):


**Required:** 1
**Type:**
**Default:**
**Description:** The properties of a sensor noise model.
](spec?ver=1.11&elem=sensor#y_noise)


#####  <orientation_reference_frame> Element


The parent name is set by [ Sensor::SetParent
](classgazebo_1_1sensors_1_1Sensor.html#a8d07a3535e558a172e212f73b942d39d "Set
the sensor's parent. ") .


    $ ros2 topic echo /demo/imu --once
    header:
      stamp:
        sec: 61
        nanosec: 838000000
      frame_id: base_link
    orientation:
      x: -1.537258480573929e-09
      y: 1.4639308030715501e-05
      z: 0.004202907273712188
      w: 0.9999911676390645
    orientation_covariance:
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    - 0.0
    angular_velocity:
      x: 6.531781238713562e-05
      y: -0.00010195262499235747
      z: 9.86782271776771e-06
    angular_velocity_covariance:
    - 4.0e-08
    - 0.0
    - 0.0
    - 0.0
    - 4.0e-08
    - 0.0
    - 0.0
    - 0.0
    - 4.0e-08
    linear_acceleration:
      x: -0.09869154506498802
      y: -0.11664874054304436


**Required:** 1
**Type:** string
**Default:** none
**Description:** The type of noise. Currently supported types are: "none" (no
noise). "gaussian" (draw noise values independently for each measurement from
a Gaussian distribution). "gaussian_quantized" ("gaussian" plus quantization
of outputs (ie. rounding))  ](spec?ver=1.11&elem=sensor#noise_type)


#####  <horizontal> Element


#####  <pressure> Element


**Required:** 1
**Type:** double
**Default:** 277
**Description:** Y focal length (in pixels, overrides horizontal_fov)
](spec?ver=1.11&elem=sensor#intrinsics_fy)


Sensor::DisconnectUpdated


#####  <noise> Element


#####  <magnetometer> Element


©2020 Open Source Robotics Foundation


#####  <mean> Element


##  1  Answer


Returns


#####  Versions


](classgazebo_1_1sensors_1_1Sensor.html#a9a22d0e822e1d2bcd03c8594a0f5a40b)
(const bool _value)
|  Set whether the sensor is active or not.  More...

void  |  [ SetParent
](classgazebo_1_1sensors_1_1Sensor.html#a8d07a3535e558a172e212f73b942d39d)
(const std::string &_name, const uint32_t _id)
|  Set the sensor's parent.  More...

virtual void  |  [ SetPose
](classgazebo_1_1sensors_1_1Sensor.html#a8c2db08c71f7336337638d692016a7c3)
(const ignition::math::Pose3d &_pose)
|  Set the current pose.  More...

void  |  [ SetReferencePose
](classgazebo_1_1sensors_1_1ImuSensor.html#a20864e364958c8afb4aa2fc19590a845)
()
|  Sets the current IMU pose as the reference NED pose, i.e.  More...

void  |  [ SetUpdateRate
](classgazebo_1_1sensors_1_1Sensor.html#ab690e2f1eb0abc5714d5b46728484138)
(const double _hz)
|  Set the update rate of the sensor.  More...

void  |  [ SetWorldToReferenceOrientation
](classgazebo_1_1sensors_1_1ImuSensor.html#af59c24d06c5269aa6514600417c537d1)
(const ignition::math::Quaterniond &_orientation)
|  Sets the rotation transform from world frame to IMU's reference frame.
More...

virtual std::string  |  [ Topic
](classgazebo_1_1sensors_1_1Sensor.html#a5c1570a89eb756891f9533b09124d37e) ()
const
|  Returns the topic name as set in SDF.  More...

std::string  |  [ Type
](classgazebo_1_1sensors_1_1Sensor.html#a53eb7c9ddd028d156afd7bec4a9fd749) ()
const
|  Get sensor type.  More...


#####  <aspect_ratio> Element


**Required:** 0
**Type:** string
**Default:** euler_rpy
**Description:** 'euler_rpy' by default. Supported rotation formats are
'euler_rpy', Euler angles representation in roll, pitch, yaw. The pose is
expected to have 6 values. 'quat_xyzw', Quaternion representation in x, y, z,
w. The pose is expected to have 7 values.
](spec?ver=1.11&elem=sensor#pose_rotation_format)


: An SDFormat element. Click the box to get a link.  : An SDFormat attribute.
Click on the box to get a link.  : An element with children. Click the icon to
toggle the children.
: The element has no children.
: An element defined in another tab. Click icon to open the tab.


Inheritance diagram for gazebo::sensors::ImuSensor:


[ **updated 2022-08-17 03:36:43 -0500  ** ](/answers/405137/revisions/)


  * robot description [ turtlebot3_waffle.urdf ](https://github.com/ros-planning/navigation2/blob/humble/nav2_bringup/urdf/turtlebot3_waffle.urdf)
  * sdf gazebo model file [ waffle.model ](https://github.com/ros-planning/navigation2/blob/humble/nav2_bringup/worlds/waffle.model)
  * nav2 launch file [ bringup_launch.py ](https://github.com/ros-planning/navigation2/blob/humble/nav2_bringup/launch/bringup_launch.py)


#####  <stddev> Element


**Required:** 0
**Type:** string
**Default:**
**Description:** If specified, this pose is expressed in the named frame. The
named frame must be declared within the same scope (world/model) as the
element that has its pose specified by this tag. If missing, the pose is
expressed in the frame of the parent XML element of the element that contains
the pose. For exceptions to this rule and more details on the default
behavior, see http://sdformat.org/tutorials?tut=pose_frame_semantics. Note
that @relative_to merely affects an element's initial pose and does not affect
the element's dynamic movement thereafter. New in v1.8: @relative_to may use
frames of nested scopes. In this case, the frame is specified using `::` as
delimiter to define the scope of the frame, e.g.
`nested_model_A::nested_model_B::awesome_frame`.
](spec?ver=1.11&elem=sensor#pose_relative_to)


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the standard deviation of the Gaussian
distribution from which noise values are drawn.
](spec?ver=1.11&elem=sensor#noise_stddev)


**Required:** 1
**Type:** double
**Default:** 1
**Description:** Aspect ratio of the near and far planes. This is the width
divided by the height of the near or far planes.
](spec?ver=1.11&elem=sensor#logical_camera_aspect_ratio)


Here is a sample of imu data (look at linear_acceleration.z value, it is about
zero value), while robot stands still (not moving anywhere):


     [in]  |  _pose  |  New pose of the sensor.
---|---|---

See Also


**Required:** 0
**Type:**
**Default:**
**Description:** Noise parameters for vertical velocity measurement, in units
of meters/second.  ](spec?ver=1.11&elem=sensor#velocity_sensing_vertical)


msgs::IMU ImuMessage  |  (  |  |  )  |  const
---|---|---|---|---

Returns the imu message.


#####  <bias_stddev> Element


msgs::IMU gazebo::sensors::ImuSensor::GetImuMessage  |  (  |  |  )  |  const
---|---|---|---|---

Returns the imu message.


**Required:** 0
**Type:** double
**Default:** 0.5
**Description:** Radius of the sonar cone at max range. This parameter is only
used if geometry is "cone".  ](spec?ver=1.11&elem=sensor#sonar_radius)


  {
    gzerr << "Failed to set sensor topic [" << _topic << "]" << std::endl;
    return false;
  }
  this->topic = validTopic;
  return true;
}
//////////////////////////////////////////////////
bool Sensor::EnableMetrics() const
{
  return this->dataPtr->enableMetrics;
}
//////////////////////////////////////////////////
void Sensor::SetEnableMetrics(bool _enableMetrics)
{
  this->dataPtr->enableMetrics = _enableMetrics;
}
//////////////////////////////////////////////////
void Sensor::PublishMetrics(const std::chrono::duration<double> &_now)
{
  return this->dataPtr->PublishMetrics(_now);
}
//////////////////////////////////////////////////
void SensorPrivate::PublishMetrics(const std::chrono::duration<double> &_now)
{
  if (!this->performanceSensorMetricsPub)
  {
    const auto validTopic = transport::TopicUtils::AsValidTopic(
      this->topic + "/performance_metrics");
    if (validTopic.empty())
    {
      gzerr << "Failed to set metrics sensor topic [" << topic << "]" <<
        std::endl;
      return;
    }
    this->performanceSensorMetricsPub =
      node.Advertise<msgs::PerformanceSensorMetrics>(validTopic);
  }
  if (!performanceSensorMetricsPub ||
      !performanceSensorMetricsPub.HasConnections())


[ edit ](/questions/405106/edit/) [ retag ](/s/questions/405106/retag/) flag
offensive  [ close ](/questions/405106/close/) merge  delete


#####  <bias_mean> Element


#####  <noise> Element


    <joint name="imu_joint" type="fixed">
      <parent link="base_link"/>
      <child link="imu_link"/>
      <origin xyz="0 0 0.01"/>
    </joint>


#####  filename  Attribute


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the mean of the Gaussian distribution
from which noise values are drawn.  ](spec?ver=1.11&elem=sensor#noise_mean)


#####  <dynamic_bias_correlation_time> Element


**Required:** 0
**Type:** double
**Default:** 0
**Description:** For type "gaussian*", the correlation time in seconds of the
noise used to drive a process to model slow variations in a sensor bias. A
typical value, when used, would be on the order of 3600 seconds (1 hour).
](spec?ver=1.11&elem=sensor#noise_dynamic_bias_correlation_time)


Returns


#####  <stddev> Element


#####  <precision> Element


#####  <velocity_sensing> Element


node
](classgazebo_1_1sensors_1_1Sensor.html#a5e3ca451509c1cc8b1207f78bcd97f4b)
|  Node for communication.  More...

std::vector< [ NoisePtr
](namespacegazebo_1_1sensors.html#a78b16878dcf8c99b93d0da0832d4355f) > |  [
noises
](classgazebo_1_1sensors_1_1Sensor.html#a3750c2ec4d65d8ebd8831a0cb4ae1ff6)
|  [ Noise ](classgazebo_1_1sensors_1_1Noise.html "Noise models for sensor
output signals. ") added to sensor data.  More...

uint32_t  |  [ parentId
](classgazebo_1_1sensors_1_1Sensor.html#a6e2f5496c25f487892a4ab033804fa6a)
|  The sensor's parent ID.  More...

std::string  |  [ parentName
](classgazebo_1_1sensors_1_1Sensor.html#ad799658c9bfff543acd63224751dbcdc)
|  Name of the parent.  More...

std::vector< [ SensorPluginPtr
](namespacegazebo.html#a53318781354148f17eeb05acf5e6eb21) > |  [ plugins
](classgazebo_1_1sensors_1_1Sensor.html#a30f81e4e2760368bcaa1e2b6f997f95f)
|  All the plugins for the sensor.  More...

[ math::Pose ](classgazebo_1_1math_1_1Pose.html) |  [ pose
](classgazebo_1_1sensors_1_1Sensor.html#a2f5b277aee9fc02508f77dc412f7bb41)
|  Pose of the sensor.  More...

[ transport::SubscriberPtr
](namespacegazebo_1_1transport.html#a01301f6b99e707645338197bbabd6457) |  [
poseSub
](classgazebo_1_1sensors_1_1Sensor.html#ac7bd5efa8bef9bb650dd481beb07ea00)
|  Subscribe to pose updates.  More...

[ gazebo::rendering::ScenePtr
](namespacegazebo_1_1rendering.html#ae7a18e19cb48110b3cc879203bd6634b) |  [
scene
](classgazebo_1_1sensors_1_1Sensor.html#a3475ef8e2de1bfea72b09c3ec92a7e81)
|  Pointer to the Scene.  More...