Everything about Drone
  • Drone (Dynamic Remotely Operated Navigation Equipment)
  • About Me
  • Types of Drones
  • Applications of Drone
  • Categories of Drones in India
  • Motor Configuration and Controls for Quadcopter
  • Assembling Pluto Drone
  • Dynamics of DRONEs
    • Force and Moments
    • Orientation and position
    • Moving in z, x & y direction
  • Sensors which are used on a Drone
  • Rules & Regulations
  • Testing & Executing codes
    • Acro Mode
    • Blow to Take Off
    • App Heading
    • Monitoring the Pressure Difference
    • Throw and Go
    • Flipping
  • Laser Cutting
  • Laser Cutting Procedure
  • 3D Printing Drone case
  • Table Tennis Game
  • ROS (Robotic Operating System)
    • ROS Master
    • ROS Nodes
    • ROS Topics
    • ROS Message
    • Workspace (catkin)
    • Examples
      • Creating ROS Workspace
      • Publisher in ROS
      • Subscriber in ROS
      • Testing Publisher and Subscriber nodes
      • Add two int in ROS
      • Building Nodes
      • Pluto Node
Powered by GitBook
On this page

Was this helpful?

Table Tennis Game

If we execute this program/code then we can play the game with the help of drone


// Do not remove the include below
#include "PlutoPilot.h"
#include "XRanging.h"
#include "Utils.h"
#include "User.h"

int16_t Rangel = 0;
int16_t Ranger = 0;
//The setup function is called once at Pluto's hardware startup
void plutoInit()
{
	XRanging.init(LEFT);
	XRanging.init(RIGHT);

// Add your hardware initialization code here
}



//The function is called once before plutoLoop when you activate Developer Mode
void onLoopStart()
{
	LED.flightStatus(DEACTIVATE);
  // do your one time stuff here

}



// The loop function is called in an endless loop
void plutoLoop()
{
Rangel=XRanging.getRange(LEFT);
Ranger=XRanging.getRange(RIGHT);

if (Ranger<300)
{
	RcCommand.set(RC_ROLL,1450);
LED.set(RED, ON);
LED.set(GREEN,OFF);
}
else if (Rangel<300)
{
 RcCommand.set(RC_ROLL,1550);
 LED.set(GREEN,ON);
 LED.set(RED,OFF);
}
else{
	RcCommand.set(RC_ROLL, 1500);
	LED.set(GREEN,OFF);
	LED.set(RED,OFF);
}
//Add your repeated code here

}



//The function is called once after plutoLoop when you deactivate Developer Mode
void onLoopFinish()
{
LED.flightStatus(ACTIVATE);
// do your cleanup stuffs here

}




For this game we had first tried to get the values from the distance sensor so on the monitor we get these values

Previous3D Printing Drone caseNextROS (Robotic Operating System)

Last updated 5 years ago

Was this helpful?

When the object is at distance (Distance is in mm)
When the object is too close (Distance is in mm)
Playing Hover Tennis with Drone