Repository navigation
Replies: 5 comments 4 replies
|
Hi! So.. this simulation does not look very familiar to me. Is this a project that you made yourself? What is the main part of crazyswarm2 that is blocking you? We need quite a lot more information here if the scope is outside of the Crazyswarm2 project |
|
I addition, it seems like most of the application-specific things are not really relevant for the issue at hand. Try to include a minimal example without additional dependencies that demonstrates the issue you are having. |
|
So there is a repository called GADEN2 which is runs a 3D simulation of a gas dispersion from a source in a room(with walls and doors). This 3D environment has parameters such as gas type, gas dispersion speed, 3D walls, etc. which are used to create 3D gas dispersing simulation. I use crazyswarm2 package to deploy a swarm of crazyflie drones(4) in this 3D environment and based on my algorithm it will identify the gas source. So in the algorithm all the 4 drones have to takeoff using the cf.takeoff command(cf is crazyflie script from the crazyflie package) and reach a certain height(0.5m) which it does. After it reaches the height, there is a random point generated within the 3D space and based on drone's current position it calculates the velocity required to move in the direction of the Random Point. The script has 2 modes that the drone follows: Random Point Mode and Bout Following mode. But in the simulation after the drone reaches 0.5m, all the 4 drones tend to drift and crash to the ground. There is no stable movement in the drone to reach the random point and then switch to the Bout following mode depending on gas it has to swirl around it or not and then switch back to Random point mode and so on. I have added DEBUG lines so I can confirm that the velocity does get sent to crazyflie_sil.py and to the PID controller scripts. So my logic script generates a velocity which is sent to crazyflie_server.py which then sends it to crazyflie_sil.py and then to the PID controller scripts. This PID controller script then calculates the PWM values for each motor which is then sent to crazyflie_sil.py to convert PWM to RPM values. These values are then sent to crazyflie_server.py which calls the physics backend (np.py). np.py then converts the RPM values to forces. Since np.py is responsible for the simulation i tried tweaking the mass and force values but that did not fix the issue there is still instability in the drone's movement. I'm not sure if this is causing the issue:
|
|
It sounds like you first take off using the high-level commands like goTo. Afterwards, you switch to low-level commands - which ones exactly? Did you try just keep using high-level commands (e.g., goTo) instead? |
|
So I use the def takeoff() function from class crazyflie in the crazyflie.py scripts(from crazyflie_py package). After it reaches the height required, my logic script then generates a random point and calculates velocity to reach the Random Point. These velocity values are published using the def cmdVelocityWorld() function from crazyflie.py. The executeController(self) function from crazyflie_sil.py sends it to the PID controller scripts and the def cmdVelocityWorld() function from crazyflie_sil.py stores the velocity values as setpoint and X;Y;Z and yaw are assigned as modeVelocity and not modeAbs and velocity_body is False. The executeController(self) function from crazyflie_sil.py then sends the PWM values from PID scripts to get converted into RPM values and send the result back to crazyflie_server.py This line self.backend.step(states_desired, actions) from the function def _timer_callback(self) in crazyflie_server.py calls the physics backend and further functions from the class Backend and the class Quadrotor receive the RPM values which converts to forces. |
Uh oh!
There was an error while loading. Please reload this page.
I am working with a swarm of Crazyswarm drones. The simulation is set up as follows:
There is a closed room with a source dispersing gas particles. There are 4 drones (eventually, I will add more) deployed in this environment that must identify the gas source based on specific logic. The simulation of the gas-dispersing environment is created using GADEN2.
Each drone runs a main script that switches between two modes: "Random Point" mode and "Bout Following" mode. The drone first takes off and reaches a certain height. It then switches to Random Point mode, where the algorithm calculates the necessary velocity and direction to reach that point. As it approaches and crosses a threshold of being near that point, it switches to Bout Following mode, where the drone checks for gas plumes. If gas is detected, the drone swirls around; if not, it switches back to Random Point mode and moves towards a new point.
The issue is that in the simulation, the drone takes off and reaches the target height but does not enter Random Point mode. Instead, it starts descending towards the ground. In the terminal, I can see that the scripts are generating the necessary velocity and sending it to crazyflie_sil.py, which then forwards it to the PID controller scripts.
Ascending.mp4
Descending.mp4
All reactions