How not run headless in my_parrotdrone_openai_example?

I am currently running ROS Melodic on Ubuntu 18.04

I am using these three repos:

  • git clone -b version2 https://bitbucket.org/theconstructcore/openai_ros.git
  • git clone -b version2 https://bitbucket.org/theconstructcore/openai_examples_projects.git
  • git clone -b kinetic-gazebo9 https://bitbucket.org/theconstructcore/parrot_ardrone.git

Within the my_parrotdrone_openai_example package, I have edited:

  • parrotdrone_openai_qlearn_params_v2.yaml to have the correct ros_ws_abspath path
  • start_qlearning_v2.py to set log_level=rospy.DEBUG

After catkin_make; source devel/setup.bash I am running:

  • roslaunch my_parrotdrone_openai_example start_training_v2.launch

From the debug output, it appears to be training. However, there is no gzclient running. What do I need to change to render everything on gazebo?

Hi,

The parrot simulation launch ha to be changed to use gzclient.
For that you should edit parrot_ardrone/drone_construct/launch/start_world.launch:

Otherwise it wont launch the simulation.

Another faster and easier option is to just launch it in ROSDevelopmenetStudio inside a Melodic ROSject: ROSDS

Hi, what should I change in the launch file? This is the current launch file:

<launch>
  <arg name="world_name" default="$(find drone_construct)/worlds/ardrone_igniteworld.world"/>
  <!-- start gzserver and load the map -->
  <node name="gazebo" pkg="sjtu_drone" type="start_gzserver" args="$(arg world_name)" respawn="false"/>
</launch>

Here’s the script the launch file is calling:

#!/bin/sh
#store the argument passed to the script
final="$@"

#find where the 'sjtu_drone' is
pack_path=$(rospack find sjtu_drone)

#export the gazebo pathes
export GAZEBO_MODEL_PATH=$pack_path/models:$GAZEBO_MODEL_PATH 
export GAZEBO_RESOURCE_PATH=$pack_path:/usr/share/gazebo-3.0:/usr/share/gazebo-4.0:/usr/share/gazebo_models:$GAZEBO_RESOURCE_PATH
export GAZEBO_PLUGIN_PATH=$pack_path/plugins:$GAZEBO_PLUGIN_PATH

#start the gazebo server
#gzserver $final --verbose -s libplugin_ros_init.so 
rosrun gazebo_ros gzserver $final

Right now when running gzclient or rosrun sjtu_drone start_gui, the vm goes black. This doesn’t happen for other examples (i.e. turtlebot3), only the parrotdrone example.

Yeah,
ParrotDrone simulation is quite tricky when launching it for gzclient.

Create a launch similar to this:

start.launch

<node name=“gui” pkg=“sjtu_drone” type=“start_gui” args=“$(arg world_name)” respawn=“false”/>

It has given issues locally depending on the ROS version so you will probably have to debug there.
If you have issues, just do it in ROSDS that is ready to work ;).

Yeah it’s super odd how it works on ROSDS but not locally when both is running Melodic/Gazebo 9. I tried:

  1. replacing the node in start_world.launch with your node -> no ROS master
  2. appending your node after the node in start_world.launch -> same issue: black screen; crashes vm display (terminal still works)

Fixed it! Steps:

  1. In parrotdrone_goto.py (task env), change the ROSLauncher line so it’s:
    ROSLauncher(rospackage_name="sjtu_drone", launch_file_name="contest.launch", ros_ws_abspath=ros_ws_abspath)

  2. In parrotdrone_env.py (robot env), comment out the ROSLauncher() line.