Project

General

Profile

Actions

Bug #360

closed

Possibly wrong check of tag <period>

Added by Gianluca Corsini about 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal

Description

If I understood correctly, the tag <period> is used as the running period for the updater_thread, which updates all the motors.
If so, it is a property of the whole plugin and not related to a specific <rotor>.
Therefore, it should be specified outside the tag <rotors>, similarly to the following:

    <plugin name="mrsim" filename="mrsim-gazebo.so">
      <link>base</link>
      <period>1e-3</period>
      <rotors>
        <noise>0.03</noise>
        <cf>6.5e-4</cf>
        <ct>1e-5</ct>
        <rotor><joint spin="cw">rotor-1</joint></rotor>
        <rotor><joint spin="ccw">rotor-2</joint></rotor>
        <rotor><joint spin="cw">rotor-3</joint></rotor>
        <rotor><joint spin="ccw">rotor-4</joint></rotor>
      </rotors>
    </plugin>

Keeping that in mind, by looking at line 244, it seems that the tag <period> is never going to be found.

Indeed, the ElementPtr r is used, which is either pointing to the tag <rotors>, if this tag is present, or to nothing, otherwise.
In this last case, the code might run into an undefined behavior since the pointer has no prior initialization, and the code is trying to run the method HasElement.

Therefore, I think line 244 should be fixed as follows:

1000000 * (sdf->HasElement("period") ? sdf->Get<double>("period") : 1e-3);

@Anthony Mallet, is it correct what I am saying?

Actions #1

Updated by Anthony Mallet about 2 years ago

Right, there seems to be a gross issue there!
Thanks for finding this out!

You can push that fix if you feel so. I'll push it soon otherwise.

Actions #2

Updated by Gianluca Corsini about 2 years ago

Thanks for the reply :)
I tried to do it through ssh but it seems I have no right to do it. Shall I create another repository somewhere and then link the commit here?

Actions #3

Updated by Anthony Mallet about 2 years ago

On Sunday 4 Sep 2022, at 11:51, Gianluca Corsini wrote:

I tried to do it through ssh but it seems I have no right to do
it. Shall I create another repository somewhere and then link the
commit here?

I thought you had access. Members of the 'robots' unix group at LAAS
are automatically granted RW rights, but it seems you are not member
of that group.

I'll push the fix, don't worry.
Thanks!

Actions #4

Updated by Gianluca Corsini about 2 years ago

  • Status changed from New to Closed
Actions #5

Updated by Gianluca Corsini about 2 years ago

Thanks Anthony for the fix :)

Actions

Also available in: Atom PDF