Closed woensug-choi closed 3 years ago
Kinematics control plugin for WHOI hybrid gliders
~/uuv/src
folder and compile with catkin_make
at ~/uuv
directory.build.bash
script located in the docker
folder of this repository
./build.bash .
run.bash
script
./run.bash glider_kinematics
./join.bash glider_kinematics
roslaunch glider_hybrid_whoi_gazebo seafloor_underwater_world.launch
roslaunch glider_hybrid_whoi_gazebo start_demo_teleop_kinematics.launch joy_id:=0
# Using test python script
rosrun direct_kinematics_ros_plugins test_directKinematics.py
# Directly to the ros node
# Toward surface
rostopic pub /glider_hybrid_whoi/direct_kinematics/UwGlidCommand frl_vehicle_msgs/UwGliderCommand '{motor_cmd_type: 1, target_motor_cmd: 2, pitch_cmd_type: 2, target_pitch_value: -0.4, rudder_control_mode: 1, target_heading: 0.8}'
# Back to underwater
rostopic pub /glider_hybrid_whoi/direct_kinematics/UwGlidCommand frl_vehicle_msgs/UwGliderCommand '{motor_cmd_type: 1, target_motor_cmd: 2, pitch_cmd_type: 2, target_pitch_value: 0.4, rudder_control_mode: 1, target_heading: -0.8}'
rostopic echo /glider_hybrid_whoi/direct_kinematics/UwGliderStatus
Battery position | Target once | Target servo |
---|---|---|
:heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
f_pitch_battpos_cal_m
, f_pitch_battpos_cal_b
Voltage | Power |
---|---|
:heavy_check_mark: | :heavy_check_mark: |
f_thruster_voltage_v1
, f_thruster_voltage_v2
, f_thruster_voltage_v3
, f_thruster_power_w1
, f_thruster_power_w2
, f_thruster_power_w3
sqrt(motorpower/(fluidDensity*Area*C_D)
Heading | Angle (Center, Port, Stbd) | Angle (Direct) |
---|---|---|
:heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
Flight model |
---|
:heavy_check_mark: |
Lat/Lon | Roll-Pitch-Yaw | Heading | Depth | Altitude | Power | Rudder angle | Battery position | Pumped Volume | nav_sat_fix |
---|---|---|---|---|---|---|---|---|---|
:heavy_check_mark:* | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark:* | :heavy_multiplication_x: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
@daewok Dockerfile is at docker
folder :+1: It takes quite some time to build. Check installation with Docker section how to use build.bash
, run.bash
, join.bash
@daewok I've referenced as much as I can from your GitLab Dockefile. I've made it through catkin_make compile. But was not able to play the plugin.
nvidia/opengl:base-ubuntu18.04
at runtime image but without success. (Maybe run.bash
issue?)
https://github.com/Field-Robotics-Lab/glider_hybrid_whoi/blob/c1b3aff1b45be5935b931e32933af7dec21f5b8d/docker/Dockerfile#L95-L96.bashrc
Could you give it a look? It's at a new branch Kinematics_only_newdockerfile
https://github.com/Field-Robotics-Lab/glider_hybrid_whoi/blob/c1b3aff1b45be5935b931e32933af7dec21f5b8d/docker/Dockerfile#L1-L201
I just pushed some commits to the new branch. With them, I'm able to do ./build.bash
and ./run.bash -w glider_kinematics
and get the simulator to run. (note that I'm not using my GPU and I haven't tried with a GPU yet).
The reason so many deps were missed is that the rosdep ... install
command was actually failing, but it was masked since it was in a pipe and -o pipefail
was not set. I changed that so it should now complain if rosdep fails for some reason.
I just pushed some commits to the new branch. With them, I'm able to do
./build.bash
and./run.bash -w glider_kinematics
and get the simulator to run. (note that I'm not using my GPU and I haven't tried with a GPU yet).The reason so many deps were missed is that the
rosdep ... install
command was actually failing, but it was masked since it was in a pipe and-o pipefail
was not set. I changed that so it should now complain if rosdep fails for some reason.
Can't launch anything from my side. I am getting X error for gazebo
at ./run.bash -w glider_kinematics
. Any suggestions on how to solve this issue?
@mabelzhang Isn't this a magic line to set model paths? I am trying to reference the models newly included in this PR.
<export>
<gazebo_ros gazebo_model_path="${prefix}/models"/>
<gazebo_ros gazebo_media_path="${prefix}"/>
</export>
I am trying to upload a Buzzard Bay heightmap. But I can't locate it using model://
. It shouldn't be difficult. What else do I have to do to add a path for models in this PR?
That looks correct. Adding the path usually takes me a few rounds of back and forth testing...
Are you installing the packages when you compile? Try rospack find
to see where ROS thinks the package is, whether in src
or in devel
or install
. It could be that the models are only in src
but rospack find
is locating a compiled directory. In that case, you would want to install the models directory in CMakeLists.txt.
You could run Gazebo with --verbose to see if it prints anything about the path.
roslaunch glider_hybrid_whoi_gazebo BuzzBay.launch
play
button on the Gazebo window and wait for the first bathymetry to be spawned.Lat / Lon : -70.853° / 41.45°
X / Y : 470503.30 / 50036.53
[Dbg] [bathy_plugin.cc:396] Inserted model: buzzbay.R_-70.857_-70.852_41.447_41.452
Buzzbay.world
inherited from Dave project's plugin which also inherited from Mike Jakuba's plugin from Wind_energy. Regretfully, not sure what it does exactly.
<!-- Setting this to origin of EPSG:26987 -->
<spherical_coordinates>
<longitude_deg>-70.5</longitude_deg>
<latitude_deg>41.0</latitude_deg>
</spherical_coordinates>
longitude: 76.0371042964
latitude: -40.4165916257
roslaunch glider_hybrid_whoi_gazebo BuzzBay.launch
play
button on the Gazebo window and wait for the first bathymetry to be spawned.rosrun direct_kinematics_ros_plugins test_directKinematics.py
rudder_control_mode=RUDDER_CONTROL_HEADING=1
with target_heading = pi/2
)The vehicle's position and GPS value do not match exactly.
x: 480381.43
, y: 56666.85
which is Lon: -70.735
, Lat: 41.51
calculated using epsg.ioLon: -70.712083444
, Lat: 41.2136645438
This is also the case of Dave repo's rexrov tutorial case https://github.com/Field-Robotics-Lab/dave/issues/77#issuecomment-748878031. It seems it's a problem with the GPS sensor since the bathymetry is spawning correctly.
I think the PR is ready to review for merge. @daewok could you review this from the kinematics functionality point of view?
Future Todo
Future issues
I'm just getting back online after moving and xmas. I also have my desktop with GPU finally set up. So I think I'm going to tackle the Docker stuff first, since having it Dockerized will make my workflow easier.
Happy new year! Were you able to get the dockerfile working? Did you review this PR? I only see the Merge button.
Just pushed my work. I tried to update the docker/README.MD file well enough to document how it works now.
I also added a docker-compose.yml file that launches both the Gazebo simulator
and the simulated glider control system. You should just need to run
docker-compose build
and docker-compose up
to have the simulator start
up. In the absence of any other input, the glider control system just tries to
make the glider safe by surfacing.
The docker-compose file currently assumes that if you want to use a GPU the nvidia runtime is set as your default Docker runtime. If that's not the case, you'll need to create a local docker-compose.override.yml file setting the runtime to use.
To get a glider console, you can run:
docker-compose exec glider_control_sim /ros_entrypoint.sh rosrun slocum_glider_sim_driver slocum_glider_sim_console
You can then run any of the subset of Glider commands that the simulated
control system supports. You can run the simple one dive mission with run ini0.mi
. You can run a simple box mission with run inibox01.mi
. After the
missions complete, you'll need to hit Ctrl-C to tell it to finish. If you want
to quit the console hit Ctrl-D.
I did notice two oddities:
Take a look at the commit message for 92fac83. It'd be nice if we could get those PRs mentioned in it merged before this is merged.
Lots of commits! I am starting to understand why we need this. I've dealt with all PRs on this and dave repository.
gazebo_1 | libGL error: No matching fbConfigs or visuals found
gazebo_1 | libGL error: failed to load driver: swrast
gazebo_1 | X Error of failed request: GLXBadContext
gazebo_1 | Major opcode of failed request: 152 (GLX)
gazebo_1 | Minor opcode of failed request: 6 (X_GLXIsDirect)
gazebo_1 | Serial number of failed request: 44
gazebo_1 | Current serial number in output stream: 43
The last commit includes,
build.bash
/use_sim_time
parameter correctly at BuzzBay.launch fileFor two oddities,
paused=false
, use_sim_time=true
, gui=true
order. I've found an article that some codes should be added to make ROS node to wait for time synchronization article. I did not. But it works fine.Weird. It worked on my desktop with an nvidia GPU and I just tested it on the computer in Caryn House mostly successfully (docker-compose build
doesn't work on that computer... I'm guesing it's because the version of docker-compose on there is ancient and has a bug. I had to build with build.bash
and then use docker-compose up
).
Is the nvidia runtime set as the default on the computer you were using?
@daewok How do I check if the Nvidia runtime is set as the default?
Brian has suggested that we merge this PR if the kinematics functionality is working before we diverge too much in one PR. I think it is very reasonable to do so. This PR already includes Kinematics, Bathymetry, and Docker. What do you think?
Run docker info
and it should be in the output. If it's not the default, you can typically add "default-runtime": "nvidia"
to /etc/docker/daemon.json
(or however your OS configures Docker). You should also be able to use a docker-compose override file to tell docker-compose to use nvidia instead of the default, but I'm not sure what the contents of that should be. (And I don't think there's any issue with making nvidia the default over runc).
I wholeheartedly agree about merging this soon. It's already a beast.
I messed up my system. Now back online. The workstation at WHOI has nvidia runtime as default. I'll double check on my local machine.
# Terminal Window 1 at docker folder
build.bash
run.bash
roslaunch glider_hybrid_whoi_gazebo BuzzBay.launch
use_sim_time
is working correctly and could be checked by following commands 👍
# Terminal Window 2 at docker folder
join.bash
source /opt/ros/melodic/setup.bash
source ~/glider_hybrid_whoi/install/setup.bash
rostopic echo /glider_hybrid_whoi/direct_kinematics/UwGliderStatus
The log at the first window still shows time stamp of over 1600000000, however, the UwGliderStatus time stamp read on the rostopic correctly shows sim_time value (which is calculated using ros::time::now())
build.bash
and then use docker-compose up
launched ok 👍
# Terminal Window 1 at docker folder
build.bash
docker-compose up
# Terminal Window 2 at docker folder
docker-compose exec glider_control_sim /ros_entrypoint.sh rosrun slocum_glider_sim_driver slocum_glider_sim_console
# Ctrl+C to see the typable terminal cursor
run ini0.mi
run inibox01.mi
Is there join.bash
functionality for docker-compose? I wanted to check whether use_sim_time
works correctly.
During the tests, I have not seen any Gazebo hang-ups. Currently, building on another machine without Nvidia runtime. Will see what happens. (Update: with runc docker runtime, it works perfectly 👍 ).
I think this PR is ready to merge now.
Is there join.bash functionality for docker-compose? I wanted to check whether use_sim_time works correctly.
Something like this is probably what you want:
docker-compose exec gazebo bash
I was able to call up a new window using docker-compose exec glider_control_sim /ros_entrypoint.sh bash
The use_sim_time was correctly working in the docker-compose environment too.
New kinematics only PR