Field-Robotics-Lab / glider_hybrid_whoi

(Hybrid-) AUG Simulator
8 stars 9 forks source link

Tidal oscillation #30

Closed woensug-choi closed 3 years ago

woensug-choi commented 3 years ago

Adds tidal oscillation feature

Description at Dave PR https://github.com/Field-Robotics-Lab/dave/pull/102

Quickstart commands

- make sure you have the right database file path at the world file.
roslaunch glider_hybrid_whoi_gazebo start_demo_kinematics_stratified_current.launch
roslaunch glider_hybrid_whoi_gazebo BuzzBay_stratified_current.launch
crvogt commented 3 years ago

@woensug-choi Is the first command meant to be roslaunch glider_hybrid_whoi_gazebo start_demo_kinematics_stratified_current.launch?

After a couple of seconds of running it's throwing the following error: terminate called after throwing an instance of 'std::invalid_argument' what(): stoi Aborted (core dumped) [gazebo-2] process has died [pid 29102, exit code 134, cmd /opt/ros/melodic/lib/gazebo_ros/gzserver --verbose -e ode /home/carson/uuv_ws/src/glider_hybrid_whoi/glider_hybrid_whoi_gazebo/worlds/seafloor_underwater_stratified_current.world __name:=gazebo __log:=/home/carson/.ros/log/d0fe9bf6-82ba-11eb-b83c-f8e4e3854ea4/gazebo-2.log]. log file: /home/carson/.ros/log/d0fe9bf6-82ba-11eb-b83c-f8e4e3854ea4/gazebo-2*.log

Currently tracking it down, my guess based on a quick grep suggests it's happening with one of the date conversions in TidalOscillation.cc.

EDIT: confirmed I'm getting a jibberish date at some point. Feeling like I missed something I should have changed/set.

woensug-choi commented 3 years ago

@crvogt Oops, yes it's roslaunch glider_hybrid_whoi_gazebo start_demo_kinematics_stratified_current.launch. Finally, we got something out of our cross-checking process! I will look into it now.

woensug-choi commented 3 years ago

@crvogt Hmm... I've never tried running it so long at the development process. I've got the same error msg after 70 seconds. it's very difficult to debug if I have to wait for that long to see the error.

crvogt commented 3 years ago

@crvogt Hmm... I've never tried running it so long at the development process. I've got the same error msg after 70 seconds. it's very difficult to debug if I have to wait for that long to see the error.

Yeah, it shows up for me after about 3 seconds. I can check it out more tomorrow and figure out what's going on, probably easier /faster given the speed at which it's popping up for me.

woensug-choi commented 3 years ago

@crvogt I've made a little tweak commit on the plugin (https://github.com/Field-Robotics-Lab/dave/pull/102/commits/a909971c54d10d21ad34f0a5d729828d07b113a3). It's a single line to make the translation to be performed only once comparing the size of the database vectors. I think to solve the issue fundamentally, we have to deal with random errors occurring at reading the string topic. Something too deep I think. Since we know that the simulator doesn't crash with the error at the start, and assuming that the database will not be changed, I think it's a fundamental fix to some extent. Please give it a try :)

By the way, do you know why these msgs are showing?

[Err] [SensorManager.cc:333] Unable to create sensor of type[dsros_dvl]
[Wrn] [msgs.cc:1852] Conversion of sensor type[dsros_dvl] not supported.
dtdavi1 commented 3 years ago

@woensug-choi @crvogt I don't know anything that will help with the invalid argument error, but the sensor manager error is because the library with the DVL sensor isn't being loaded (the WHOI simulator defined a few sensors that are not in standard Gazebo, so the ds_sim library needs to be loaded when Gazebo starts). If you add the following to the launch file entry that starts up Gazebo, that one will be fixed:

crvogt commented 3 years ago

@woensug-choi @crvogt I don't know anything that will help with the invalid argument error, but the sensor manager error is because the library with the DVL sensor isn't being loaded (the WHOI simulator defined a few sensors that are not in standard Gazebo, so the ds_sim library needs to be loaded when Gazebo starts). If you add the following to the launch file entry that starts up Gazebo, that one will be fixed:

@dtdavi1 Cliffhanger! :)

crvogt commented 3 years ago

@woensug-choi The commit didn't help :( still crashes after about 3-5 seconds. I'll see what I can do.

dtdavi1 commented 3 years ago

@woensug-choi @crvogt For the record, I did paste this into my last post, but the system ignored it:

Damn Github.

crvogt commented 3 years ago

@woensug-choi @crvogt For the record, I did paste this into my last post, but the system ignored it: Damn Github.

@dtdavi1 I thought it was just a teaser! Also, did you paste it into the comment I've quoted here? I'm still not seeing it. Pretty odd behavior.

EDIT: This line <arg name="extra_gazebo_args" value="-s libdsros_sensors.so"/> after including empty_world.launch

crvogt commented 3 years ago

@woensug-choi The example is all over the place in terms of when it crashes for me. I've had it run for ~10 seconds, though more often it crashes immediately. Should I be adjusting dave/uuv_dave/worlds/uuv_dave_ocean_waves_transientcurrent.world?

EDIT: Aaand I was editing the wrong world file.

woensug-choi commented 3 years ago

@crvogt Maybe we should replace string array ROS msg to int arrays for each year, month, day, time, and minute. I can't think of any reason why it's crashing... random encoding error...

crvogt commented 3 years ago

@crvogt Maybe we should replace string array ROS msg to int arrays for each year, month, day, time, and minute. I can't think of any reason why it's crashing... random encoding error...

@woensug-choi Yeah, that's been my guess as well after checking everything else. Once I verify I'll start pushing commits.

crvogt commented 3 years ago

@woensug-choi I changed the messaging from string to int in a commit in Field-Robotics-Lab/dave#102. That seems to have solved the crashing issue, though sadly, not ellegantly :/ Once in a while the glider just takes off, but I don't know where that's coming from, and I don't think it's current related...

woensug-choi commented 3 years ago

@crvogt Thank you for solving the issue! As long as it works without those errors. I will take it gladly. The sudden jumps have been addressed at https://github.com/Field-Robotics-Lab/dave/issues/105 and https://github.com/Field-Robotics-Lab/dave/pull/106. I think it should be fixed when we merge the PR.

woensug-choi commented 3 years ago

The last resorting bug when converting string ROS msg into int data is fixed by @crvogt. Glad to have another person who fully understands how this plugin works. Multiple PRs are created while debugging this. Afterworks to coordinate them all in harmony will follow.