-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to create a swarm scenario with CrazyS #44
Comments
I'm happy to hear from you that you found CrazyS useful for your research. As for your question, starting from the CrazyS/rotors_gazebo/launch/crazyflie2_hovering_example.launch Lines 31 to 39 in 59f227f
What you are changing is not the namespace, but the name of the device you are using (e.g., crazyflie, firefly, etc.). This is the meaning associated with the I hope this helps. |
Hi Giuseppe Silano, Thanks for your response and just saw your message here. I will try your solution and will get back here If I will have any question. BTW in your current framework when I will spawn multiple instance of crazyflie do I need to instantiate multiple instance in different namespaces? Right now hovering example have a namespace of crazyflie2, how can I change the namespace using same hovering example? For instance If I change its namespace to crazyflie22 and then use run way point publisher node like this
Attach is screenshot where I am running way point publisher node for your current example with namespace crazyflie2 Thanks |
Below is an example of how to organize the contents of the YAML file. <group ns="$(arg mav_name)1">
<!-- CRAZYFLIE_1 -->
<include file="$(find rotors_gazebo)/launch/spawn_mav_crazyflie.launch">
<arg name="namespace" value="$(arg mav_name)1" />
<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_state_estimator" value="$(arg enable_state_estimator)" />
<arg name="log_file" value="$(arg log_file)"/>
<!-- Set the initial position -->
<arg name="x" value="-1.0"/>
<arg name="y" value="-1.0"/>
</include>
<group ns="$(arg mav_name)">
<!-- The Crazyflie position controller -->
<node name="position_controller_node" pkg="rotors_control" type="position_controller_node" output="screen">
<param name="enable_state_estimator" value="$(arg enable_state_estimator)" />
<param name="csvFilesStoring" value="$(arg csvFilesStoring)"/>
<param name="csvFilesStoringTime" value="$(arg csvFilesStoringTime)"/>
<param name="user_account" value="$(arg user_account)"/>
<rosparam unless="$(arg enable_state_estimator)" command="load" file="$(find rotors_gazebo)/resource/controller_$(arg mav_name).yaml" />
<rosparam if="$(arg enable_state_estimator)" command="load" file="$(find rotors_gazebo)/resource/controller_$(arg mav_name)_with_stateEstimator.yaml" />
<rosparam command="load" file="$(find rotors_gazebo)/resource/$(arg mav_name).yaml" />
</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" />
<node name="quaternion_to_rpy" pkg="rotors_gazebo" type="quaternion_to_rpy" output="screen" >
<remap from="odometry" to="odometry_sensor1/odometry" />
</node>
</group>
<!-- CRAZYFLIE_2 -->
<group ns="$(arg mav_name)2">
<include file="$(find rotors_gazebo)/launch/spawn_mav_crazyflie.launch">
<arg name="namespace" value="$(arg mav_name)2" />
<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_state_estimator" value="$(arg enable_state_estimator)" />
<arg name="log_file" value="$(arg log_file)"/>
<!-- Set the initial position -->
<arg name="x" value="-2.0"/>
<arg name="y" value="-1.0"/>
</include>
<group ns="$(arg mav_name)">
<!-- The Crazyflie position controller -->
<node name="position_controller_node" pkg="rotors_control" type="position_controller_node" output="screen">
<param name="enable_state_estimator" value="$(arg enable_state_estimator)" />
<param name="csvFilesStoring" value="$(arg csvFilesStoring)"/>
<param name="csvFilesStoringTime" value="$(arg csvFilesStoringTime)"/>
<param name="user_account" value="$(arg user_account)"/>
<rosparam unless="$(arg enable_state_estimator)" command="load" file="$(find rotors_gazebo)/resource/controller_$(arg mav_name).yaml" />
<rosparam if="$(arg enable_state_estimator)" command="load" file="$(find rotors_gazebo)/resource/controller_$(arg mav_name)_with_stateEstimator.yaml" />
<rosparam command="load" file="$(find rotors_gazebo)/resource/$(arg mav_name).yaml" />
</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" />
<node name="quaternion_to_rpy" pkg="rotors_gazebo" type="quaternion_to_rpy" output="screen" >
<remap from="odometry" to="odometry_sensor1/odometry" />
</node>
</group>
<!-- CRAZYFLIE_3 -->
<group ns="$(arg mav_name)3">
<include file="$(find rotors_gazebo)/launch/spawn_mav_crazyflie.launch">
<arg name="namespace" value="$(arg mav_name)3" />
<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_state_estimator" value="$(arg enable_state_estimator)" />
<arg name="log_file" value="$(arg log_file)"/>
<!-- Set the initial position -->
<arg name="x" value="-1.0"/>
<arg name="y" value="-2.0"/>
</include>
<!-- The Crazyflie position controller -->
<node name="position_controller_node" pkg="rotors_control" type="position_controller_node" output="screen">
<param name="enable_state_estimator" value="$(arg enable_state_estimator)" />
<param name="csvFilesStoring" value="$(arg csvFilesStoring)"/>
<param name="csvFilesStoringTime" value="$(arg csvFilesStoringTime)"/>
<param name="user_account" value="$(arg user_account)"/>
<rosparam unless="$(arg enable_state_estimator)" command="load" file="$(find rotors_gazebo)/resource/controller_$(arg mav_name).yaml" />
<rosparam if="$(arg enable_state_estimator)" command="load" file="$(find rotors_gazebo)/resource/controller_$(arg mav_name)_with_stateEstimator.yaml" />
<rosparam command="load" file="$(find rotors_gazebo)/resource/$(arg mav_name).yaml" />
</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" />
<node name="quaternion_to_rpy" pkg="rotors_gazebo" type="quaternion_to_rpy" output="screen" >
<remap from="odometry" to="odometry_sensor1/odometry" />
</node>
</group> Of course, it is necessary to understand whether the output interface of the |
Thanks for your fast response. Will check your proposed solution today. I also want to check lee position controller with crazyflie2. mav_hovering example have lee position controller node and i want to use same though I should have set all gain for crazyflie2. so question is how I can design proper gains for crazyflie first ? sorry I my question sounds basic. Thanks |
To use the lee position controller node you can start studying the reference paper. It's not such an easy task, but not an impossible one, I can say. |
sounds good. I will check the reference paper. Thanks |
Hey @gsilano, The expected rostopic list out when the only spawn_mav_crazyflie is launched would be (here x is the drone number)
but what I'm receving on rostopic list is only crazyflie2 topic whithout individual topics for each drone.
I've added namespace for each spawn position, my launch file looks like this
Can you please help me with this, as I want a separate set of topics for each drone but I'm only receiving only one set of topics. Thank you |
Hey @gsilano @Marslanali,
Here it was taking input as the mav_name, which corresponds to crazyflie2 without namespace. Thus it should have to be changed from mav_name to namespace.
This corrects the problem and assigns each drone with specified namespace xacro. Thanks |
Hi @krawal19 thanks and will try today. Arslan |
Hi @krawal19!! I'm happy to hear from you that you solved the issue. I will update the repository with this fix. Thanks!! |
I have made available a swarm example with the Crazyflie ( |
@gsilano Thanks alot |
@gsilano Thanks for the update. |
In the following the message received by Arslan to whom I cannot reply by email (Undelivered Mail Returned to Sender).
I hope you are in the best of your health and spirit. I've been using your CrazyS GitHub repository for building swarms of crazyflie2 nano quadrotors in Gazebo.
I've one question regarding this and would be grateful to you if you shed some light. In order to spawn multiple Crazyflie I am assigning each with different namespace same as you did for
firefly_swarm_hovering_example
. However, it did not work forcrazyflie_hovering_example
.I also have checked the rqt_graph and both "hovering example node" and
position_controller_node
do not communicate if I changed namespace in the launch file.I attaching a snippet of my launch file and rqt_graph here with email and would be grateful if you can give some comments.
The text was updated successfully, but these errors were encountered: