Setpoints

Avaialble setpoints are:

  • position setpoints in NED frame: this is (x,y,z) in meters, and yaw in radians.
  • velocity setpoints in NED frame: this is (vx,vy,vz) in meters/s, and yaw in radians.
  • attitude setpoint in quaternion: q=(q0,q1,q2,q3). zero rotation =(1,0,0,0)
  • collective thrust setpoint: normalized [0,1]
  • angular velocities setpoints, roll_rate, pitch_rate, yaw_rate in rad/s

To choose one of the previous setpoints, use the set_setPointMask() method to select the right flag that correspond to the selected setpoint type.

  • for position: obj.set_setPointMask(obj.position_yaw_flag);
  • for velocity: obj.set_setPointMask(obj.velocity_yaw_flag);
  • for attitude: obj.set_setPointMask(obj.attitude_target_flag);
  • for thrust: obj.set_setPointMask(obj.thrust_flag);
  • for angular velocities: obj.set_setPointMask(obj.angular_rates_flag);

Then, you need to set the corresponding setpoints values.

  • for position: obj.set_PositionSetPoints(mavID,x,y,z,yaw);
  • for velocity: obj.set_VelocitySetPoints(mavID,vx,vy,vz,yaw);
  • for attitude: obj.set_attitude_sp(mavID, q0,q1,q2,q3)
  • for thrust: obj.set_thrust_sp(mavID,value);
  • for angular velocities: obj.set_angular_rates_sp(mavID,r,p,y)

Next, you need to tell which vehicle to consider in the sending:

consider=1;
notconsider=0;
obj.set_setpointsFlags(mavID,consider);

Next, start the setpoints transmition:

start=1;
stop=0;
obj.sendSetPoints(start);

NOTE: the takeoff() command already starts the sendSetPoints transmission.

Don't forget to activate the OFFBOARD mode for the setpoints to take effect.
To activate OFFBOARD mode use,

mavID=1;
on=1; off=0;
m.toggle_OFFB(mavID,on);

To stop sending setpoints to a specific vehicle, use the set_setpointsFlags:

mavID=1;
stop=0;
obj.set_setpointsFlags(mavID,stop);

To stop sending setpoints to all vehicles, either zeros all the flags, or stop the transmission timer:

mavID1=1; mavID2=2;
stop=0;
obj.set_setpointsFlags(mavID1,stop);
obj.set_setpointsFlags(mavID2,stop);
% ------or-------
obj.sendSetPoints(stop);

results matching ""

    No results matching ""