Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: QEI2 PID IMU6050Ver11 Watchdog VL53L1X_Filter ros_lib_kinetic
Dependents: Version1-6 Version1-7
wheelchair.h
- Committer:
- jvfausto
- Date:
- 2018-08-28
- Revision:
- 17:7f3b69300bb6
- Parent:
- 16:b403082eeacd
- Child:
- 19:71a6621ee5c3
File content as of revision 17:7f3b69300bb6:
#ifndef wheelchair
#define wheelchair
#include "chair_BNO055.h"
#include "PID.h"
#include "QEI.h"
#include <ros.h>
#include <geometry_msgs/Twist.h>
//#include "BufferedSerial.h"
//#include "chair_MPU9250.h"
#define turn_precision 10
#define def (2.5f/3.3f)
#define high 3.3f/3.3f
#define offset .02f
#define low (1.7f/3.3f)
#define process .1
/* for big mbed board
#define xDir D12 //top right two pins
#define yDir D13 //top left two pins
#define Encoder1 D0
#define Encoder2 D1
*/
//for small mbed board
#define xDir D9
#define yDir D10
#define Encoder1 D7
#define Encoder2 D8
#define EncoderReadRate 1200
#define Diameter 31.75
/** Wheelchair class
* Used for controlling the smart wheelchair
*/
class Wheelchair
{
public:
/** Create Wheelchair Object with x,y pin for analog dc output
* serial for printout, and timer
*/
Wheelchair(PinName xPin, PinName yPin, Serial* pc, Timer* time);
/** move using the joystick */
void move(float x_coor, float y_coor);
/* turn right a certain amount of degrees (overshoots)*/
double turn_right(int deg);
/* turn left a certain amount of degrees (overshoots)*/
double turn_left(int deg);
/* turn right a certain amount of degrees using PID*/
void pid_right(int deg);
/* turn left a certain amount of degrees using PID*/
void pid_left(int deg);
/* turning function that turns any direction */
void turn(int deg);
/* drive the wheelchair forward */
void forward();
/* drive the wheelchair backward*/
void backward();
/* turn the wheelchair right*/
void right();
/* turn the wheelchair left*/
void left();
/* stop the wheelchair*/
void stop();
/* function to get imu data*/
void compass_thread();
void distance_thread();
void pid_foward(double mm);
void pid_reverse(double mm);
float getDistance();
void resetDistance();
void pid_turn(int deg);
private:
PwmOut* x;
PwmOut* y;
chair_BNO055* imu;
Serial* out;
Timer* tim;
Timer* ti;
QEI* wheel;
};
#endif