Skip to content

Instantly share code, notes, and snippets.

@trekshcool
Created January 17, 2018 05:45
Show Gist options
  • Save trekshcool/edf5f7c5ae5c2370d4061233d97540d8 to your computer and use it in GitHub Desktop.
Save trekshcool/edf5f7c5ae5c2370d4061233d97540d8 to your computer and use it in GitHub Desktop.
/**
* @file MyServer.h
* @brief MyServer for the RBE3001 robotic arm
*
* @section RBE3001 - Nucleo Firmware - MyServer
*
*/
#ifndef RBE3001_MyServer
#define RBE3001_MyServer
#include <PID_Bowler.h>
#include <PacketEvent.h>
#include "../drivers/MyPid.h"
#include <cmath> // needed for std::abs
#define MyServer_ID 1 // identifier for this server
/**
* @brief Class that receives setpoints through HID and sends them to
* the PID controller. Extends the `PacketEventAbstract' class.
*/
class PidServer: public PacketEventAbstract
{
private:
PIDimp ** myPidObjects; // array of PidServers - one for each joint
int myPumberOfPidChannels;
public:
PidServer (PIDimp ** pidObjects, int numberOfPidChannels)
: PacketEventAbstract(PID_SERVER_ID)
{
myPidObjects = pidObjects;
myPumberOfPidChannels = numberOfPidChannels;
}
// This method is called every time a packet from MATLAB is received
// via HID
void event(float * buffer);
};
#endif /* end of include guard: RBE3001_MyServer */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment