Log in

View Full Version : FRCSIM Gazebo Model Problem


garystjean
13-02-2016, 16:22
When using FRCSIM/Gazebo it works OK for a while, then the robot falls through the floor. Here is what I've been trying:

1) Download the 2016 world model for Gazebo from here: http://first.wpi.edu/FRC/roborio/release/simulation/downloads/frc2016.world

2) Installed/Configured FRCSIM and WPILIB Eclipse plugin per using the frcsim-installer.sh per wpi screensteps

3) Using the GearsBot sample code, I create a Java program and I am able to get the program running

4) I load up the frc2016.world file with frcsim and then I manually add the Gearsbot model to the world

5) After I drive it around successfully for a couple minutes the robot appears to drop through the floor, so only the top 1/2 of the robot is visible.

6) At this point there does not appear to be a way to use the robot, i need to delete it from the Gazebo world then re-insert a new Gearsbot model into the world.

7) I've attached a couple screenshots that show the before/after images.

Success
https://drive.google.com/file/d/0BxYzVtrcwMiTZE02T1lZTzI3eDg/view?usp=sharing

Failure
https://drive.google.com/file/d/0BxYzVtrcwMiTRlNrNUFFNDUyblk/view?usp=sharing

Has anyone else been having this problem? Is it a problem with the frc2016.world file?

Thanks
-Gary

garystjean
13-02-2016, 16:50
Also, here is the output from the terminal where I ran frcsim:

gstjean@gstjean-ubuntu:~/wpilib/simulation/worlds$ frcsim frc2016.world
Gazebo multi-robot simulator, version 6.5.1
Copyright (C) 2012-2015 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

Gazebo multi-robot simulator, version 6.5.1
Copyright (C) 2012-2015 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 10.160.169.9
[Msg] Publicized address: 10.160.169.9
[Msg] Initializing clock: /gazebo/frc/time
[Msg] Initializing motor: /gazebo/frc/simulator/pwm/1 joint=jFrontLeft multiplier=20
[Msg] Initializing motor: /gazebo/frc/simulator/pwm/2 joint=jBackLeft multiplier=20
[Msg] Initializing motor: /gazebo/frc/simulator/pwm/3 joint=jFrontRight multiplier=-20
[Msg] Initializing motor: /gazebo/frc/simulator/pwm/4 joint=jBackRight multiplier=-20
[Msg] Initializing encoder: /gazebo/frc/simulator/dio/1/2 joint=jBackLeft radians=0
[Msg] Initializing encoder: /gazebo/frc/simulator/dio/3/4 joint=jBackRight radians=0
[Msg] Initializing gyro: /gazebo/frc/simulator/analog/1 link=chassis axis=2 radians=0
[Msg] Initializing rangefinder: /gazebo/frc/simulator/analog/6 sensor=chassisUltrasonic
[Msg] Initializing motor: /gazebo/frc/simulator/pwm/5 joint=jElevator multiplier=20
[Msg] Initializing potentiometer: /gazebo/frc/simulator/analog/2 joint=jElevator radians=1
[Msg] Initializing motor: /gazebo/frc/simulator/pwm/6 joint=jWrist multiplier=5
[Msg] Initializing potentiometer: /gazebo/frc/simulator/analog/3 joint=jWrist radians=0
[Msg] Initializing motor: /gazebo/frc/simulator/pwm/7 joint=jLeftFinger multiplier=1
[Msg] Initializing motor: /gazebo/frc/simulator/pwm/7 joint=jRightFinger multiplier=1
[Msg] Initializing limit switch: /gazebo/frc/simulator/dio/5 type=external
[Msg] external limit switch: sensor=leftFingerContact
[Wrn] [Publisher.cc:140] Queue limit reached for topic /gazebo/default/pose/local/info, deleting message. This warning is printed only once.

Peter Mitrano
13-02-2016, 18:09
Hey there! You're in luck--There is a well known solution to this.

You can find a detailed video that indirectly addresses the issue here (https://www.youtube.com/watch?v=bDQF7M6RPds)

The issue is that the PID calculations can produce NaN if the timestep is too small. Sending NaN as a protobuf message over gazebo transport turns into 2000 netwons in Gazebo, and the robot kinda explodes... I haven't worked out a good solution to this yet, but an easy temporary fix is to write pidOutput in an if statement.

EX:

void usePIDOutput(double output){
if (!Double.isNaN(output)){
motor.set(output);
}
}

garystjean
16-02-2016, 12:59
Peter, Thanks for the detailed explanation on YouTube - that was very helpful.

-Gary