Week 5-rotors_driver prototype package completion
Week 5
- In the previous meeting we brainstormed regarding how drone wrapper can be utilised with rotors sim without changing it. The PR which I opened during last week was discussed and the next week goals regarding the new rotors sim were decided. The PR & issue are in this post and the updates in this week’s post.*
How did I contributed in this week?
So, first of all before moving on with developing a driver for interfacing rotors sim with drone wrapper it was quite necessary to change the drone model as it didn’t had a good size ratio with other gazebo models as it was a Crazyfile2 (a nanocopter). Then I finished developing the rotors driver package for interfacing and used the combined work to solve follow_turtlebot exercise.
-
Here’s the new drone model: The drone model was changed to firefly, for getting a better size ratio for the drone exercises
-
Testing out the new drone model with simple control node:
The node basically was used to create publisher and subscriber for controlling the position of the drone using LeePositionController Node
- These two launch files were changed with drone the new drone model and a camera plugin added (follow_turtlebot & drone_cat_and_mouse respectively):
<?xml version="1.0" encoding="UTF-8"?>
<launch>
<arg name="mav_name" default="firefly"/>
<arg name="enable_logging" default="false" />
<arg name="enable_ground_truth" default="true" />
<arg name="log_file" default="$(arg mav_name)" />
<arg name="debug" default="false"/>
<arg name="gui" default="false"/>
<arg name="paused" default="false"/>
<arg name="headless" default="true"/>
<arg name="use_sim_time" value="true"/>
<arg name="enable_camera_sensor" default="true"/>
<!-- The following line causes gzmsg and gzerr messages to be printed to the console
(even when Gazebo is started through roslaunch) -->
<arg name="verbose" default="true"/>
<!-- The following lines simulate the world in Gazebo. -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="/RoboticsAcademy/exercises/follow_turtlebot/web-template/follow_turtlebot.world" />
<arg name="debug" value="$(arg debug)" />
<arg name="paused" value="$(arg paused)"/>
<arg name="use_sim_time" value="$(arg use_sim_time)"/>
<arg name="headless" value="$(arg headless)"/>
<arg name="gui" value="$(arg gui)" />
<arg name="verbose" value="$(arg verbose)"/>
</include>
<!-- turtlebot_with_colored_plate -->
<arg name="x_pos" default="0.0"/>
<arg name="y_pos" default="0.0"/>
<arg name="z_pos" default="0.0"/>
<param name="robot_description" command="$(find xacro)/xacro $(find drone_assets)/urdf/turtlebot3_waffle_pi_colored_plate.xacro" />
<node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-urdf -model turtlebot3 -x $(arg x_pos) -y $(arg y_pos) -z $(arg z_pos) -param robot_description" />
<group ns="$(arg mav_name)">
<!-- The following lines simulate the Firefly dynamics -->
<include file="$(find rotors_gazebo)/launch/spawn_mav.launch">
<arg name="mav_name" value="$(arg mav_name)" />
<arg name="model" value="$(find rotors_description)/urdf/mav_generic_odometry_sensor.gazebo" />
<arg name="enable_logging" value="$(arg enable_logging)" />
<arg name="enable_ground_truth" value="$(arg enable_ground_truth)" />
<arg name="enable_camera_sensor" value="$(arg enable_camera_sensor)"/>
<arg name="log_file" value="$(arg log_file)"/>
</include>
<!-- The Firefly position controller -->
<node name="lee_position_controller_node" pkg="rotors_control" type="lee_position_controller_node" output="screen">
<rosparam command="load" file="$(find rotors_gazebo)/resource/lee_controller_$(arg mav_name).yaml" />
<rosparam command="load" file="$(find rotors_gazebo)/resource/$(arg mav_name).yaml" />
<remap from="odometry" to="odometry_sensor1/odometry" />
</node>
<node name="hovering_example" pkg="rotors_gazebo" type="hovering_example" output="screen"/>
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
</group>
<!-- Drone model param -->
<arg name="drone_model" default="firefly"/>
<param name="drone_model" type="str" value="$(arg drone_model)" />
<!-- Rotors driver node -->
<node name="rotors_driver_node" pkg="rotors_driver" type="rotors_driver_node.py" output="screen"/>
</launch>
<?xml version="1.0" encoding="UTF-8"?>
<launch>
<arg name="mav_name" default="firefly"/>
<arg name="enable_logging" default="false" />
<arg name="enable_ground_truth" default="true" />
<!-- <arg name="enable_state_estimator" default="false" /> --> <!-- as a comment for future possible use of state estimator -->
<arg name="enable_mellinger_controller" default="false"/>
<arg name="headless" default="true"/>
<arg name="log_file" default="$(arg mav_name)" />
<arg name="paused" value="false"/>
<arg name="use_sim_time" value="true"/>
<arg name="debug" default="false"/>
<arg name="gui" default="false"/>
<arg name="enable_camera_sensor" default="true"/>
<!-- uncomment to save logs -->
<!-- <arg name="csvFilesStoring" default="false"/> -->
<!-- <arg name="csvFilesStoringTime" default="15.0"/> --> <!-- seconds -->
<!-- <arg name="user_account" default="your_account_name"/> -->
<!-- The following line causes gzmsg and gzerr messages to be printed to the console
(even when Gazebo is started through roslaunch) -->
<arg name="verbose" default="true"/>
<!-- The following lines simulate the world in Gazebo. -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="/RoboticsAcademy/exercises/drone_cat_mouse/web-template/drone_cat_mouse.world" />
<arg name="debug" value="$(arg debug)" />
<arg name="paused" value="$(arg paused)"/>
<arg name="use_sim_time" value="$(arg use_sim_time)"/>
<arg name="headless" value="$(arg headless)"/>
<arg name="gui" value="$(arg gui)" />
<arg name="verbose" value="$(arg verbose)"/>
</include>
<group ns="$(arg mav_name)">
<!-- FIREFLY_1 -->
<include file="$(find rotors_gazebo)/launch/spawn_mav.launch">
<arg name="mav_name" value="$(arg mav_name)" />
<arg name="model" value="$(find rotors_description)/urdf/mav_generic_odometry_sensor.gazebo" />
<arg name="enable_logging" value="$(arg enable_logging)" />
<arg name="enable_ground_truth" value="$(arg enable_ground_truth)" />
<arg name="enable_camera_sensor" value="$(arg enable_camera_sensor)"/>
<arg name="log_file" value="$(arg log_file)"/>
<!-- Set the initial position -->
<arg name="x" value="-0.5"/>
<arg name="y" value="-0.5"/>
</include>
<node name="lee_position_controller_node" pkg="rotors_control" type="lee_position_controller_node" output="screen">
<rosparam command="load" file="$(find rotors_gazebo)/resource/lee_controller_$(arg mav_name).yaml" />
<rosparam command="load" file="$(find rotors_gazebo)/resource/$(arg mav_name).yaml" />
<remap from="odometry" to="odometry_sensor1/odometry" />
</node>
<node name="hovering_example" pkg="rotors_gazebo" type="hovering_example" output="screen"/>
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
</group>
<group ns="$(arg mav_name)_1">
<!-- FIREFLY_2 -->
<include file="$(find rotors_gazebo)/launch/spawn_mav.launch">
<arg name="mav_name" value="$(arg mav_name)" />
<arg name="model" value="$(find rotors_description)/urdf/mav_generic_odometry_sensor.gazebo" />
<arg name="enable_logging" value="$(arg enable_logging)" />
<arg name="enable_ground_truth" value="$(arg enable_ground_truth)" />
<arg name="enable_camera_sensor" value="false"/>
<arg name="log_file" value="$(arg log_file)"/>
<!-- Set the initial position -->
<arg name="x" value="-3.0"/>
<arg name="y" value="-0.5"/>
</include>
<node name="lee_position_controller_node" pkg="rotors_control" type="lee_position_controller_node" output="screen">
<rosparam command="load" file="$(find rotors_gazebo)/resource/lee_controller_$(arg mav_name).yaml" />
<rosparam command="load" file="$(find rotors_gazebo)/resource/$(arg mav_name).yaml" />
<remap from="odometry" to="odometry_sensor1/odometry" />
</node>
<node name="hovering_example" pkg="rotors_gazebo" type="hovering_example" output="screen"/>
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
</group>
<!-- Drone model param -->
<arg name="drone_model" default="firefly"/>
<param name="drone_model" type="str" value="$(arg drone_model)" />
<!-- Rotors driver node -->
<node name="rotors_driver_node" pkg="rotors_driver" type="rotors_driver_node.py" output="screen"/>
</launch>
-
For interfacing the drone_wrapper package (used to control the drones) with rotors sim & without making any changes, a new package was developed, rotors_driver, which maps the service and topics which drone_wrapper uses and created the msgs accordingly for drone_wrapper to receive them at it’s subscribed topics and control the drone. As in rotors there is only a position controller available, i.e., LeePositionController so, I need to develop velocity control within the rotors_driver node by simply performing integration of desired velocity along sample time to get the desired position which is further fed to our Position Controller Node.
-
rotors_driver successful build in the docker container build:
- Here’s the PR and issue opened with necessary changes for rotors_driver pacakge:
For issue
- After successfully developing the pacakge and interfacing the drone_wrapper with rotors sim, I tested out its velocity and position control:
- Same position control can be seen in RADI with DroneWrapper and using rotors_driver package for its interfacing:
- Here’s the sample solution for the follow_turtlebot exercise with rotors_driver & rotors sim using DroneWrapper class:
- There is one error still remaining to be solved in new built image. It’s opencv pacakge import error. The noticeable thing is that it doesn’t occur in the latest RADI but does in my prototype RADI involving Rotors. I will solve this error in the upcoming week. As for the sample solution of follow_turtlebot, I used scikit-image package insteas of opencv for getting the goals done. It can be seen down below as pylint message:
- The developing the rotors_driver and successfully integrating rotors sim, I have started working to add multiprocessing in these new prototype exercises with rotors sim and rotors_driver. One exercise prototype code with Multiprocessing’s use is on the way and hopefully will be completed till next week with results. The changes will be updated on this PR