Skip to content
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

Quadrotor: Craziflie motors corresponding to action dimension. #143

Open
SapanaChaudhary opened this issue Oct 31, 2023 · 4 comments
Open
Labels
question Further information is requested

Comments

@SapanaChaudhary
Copy link

Hello!

The base model for quadrotor is Bitcraze Craziflie 2.0 in the X configuration.
I was wondering here

self.ACTION_LABELS = ['T1', 'T2', 'T3', 'T4']

which action dimension corresponds to which motor from the image below?
Screenshot 2023-10-31 at 5 20 36 PM

@SapanaChaudhary SapanaChaudhary changed the title Quadrotor: crazyflie motors corresponding to action dimension. Quadrotor: Craziflie motors corresponding to action dimension. Oct 31, 2023
@Federico-PizarroBejarano
Copy link
Contributor

@JacopoPan @spencerteetaert any idea?

@JacopoPan
Copy link
Member

JacopoPan commented Nov 1, 2023

Yes, the XY positions of the inputs/motors on the quadrotor are described in the URDF, e.g., see in the lines below that prop0 is at positive 2.8cm from the center of the quad, in the quad frame, then the others in CCW order.

https://github.com/utiasDSL/safe-control-gym/blob/83fae93172782f7c6e98063da0b2425d3f741f1b/safe_control_gym/envs/gym_pybullet_drones/assets/cf2x.urdf#L40C1-L43

(AFAIK, this is true across the repo, except for the beta-iros-competition and aer1217- branches that use the Bitcraze firmware convention because they are controlled via SITL firmware instead of direct motor input).

@SapanaChaudhary
Copy link
Author

SapanaChaudhary commented Nov 1, 2023

Thank you for the reference to the urdf file.
Considering x and y axis as below:
Screenshot 2023-11-01 at 4 23 00 PM

If the action dimensions are in the same order as prop_links in the urdf file, then action dimensions look like the figure below, as opposed to the figure I had included earlier.
Screenshot 2023-11-01 at 3 32 46 PM
Is this correct?

@JacopoPan
Copy link
Member

Yes, you can also just look at these lines mapping inputs and the forces/torque in Bullet

forces = np.array(rpm**2) * self.KF
torques = np.array(rpm**2) * self.KM
z_torque = (-torques[0] + torques[1] - torques[2] + torques[3])
for i in range(4):
p.applyExternalForce(self.DRONE_IDS[nth_drone],
i,
forceObj=[0, 0, forces[i]],
posObj=[0, 0, 0],
flags=p.LINK_FRAME,
physicsClientId=self.PYB_CLIENT)
p.applyExternalTorque(self.DRONE_IDS[nth_drone],
4,
torqueObj=[0, 0, z_torque],
flags=p.LINK_FRAME,
physicsClientId=self.PYB_CLIENT)

@JacopoPan JacopoPan added the question Further information is requested label Dec 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants