-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Projet-Navigation-UPS/develop
Release TP recherche balle
- Loading branch information
Showing
53 changed files
with
4,383 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#ifndef _BALLSEARCH_ | ||
#define _BALLSEARCH_ | ||
|
||
#include <ros/ros.h> | ||
|
||
|
||
class BallSearch | ||
{ | ||
|
||
private: | ||
|
||
//Subscrbers | ||
|
||
|
||
//Publishers | ||
ros::Publisher publisherBallReference; | ||
ros::Publisher publisherBallReference2; | ||
|
||
//Messages | ||
|
||
|
||
|
||
public: | ||
|
||
BallSearch(ros::NodeHandle& node); | ||
~BallSearch(); | ||
|
||
void sendBallReference(const float linearVelocity, const float angularVelocity, const float distance, const float angle); | ||
|
||
|
||
|
||
|
||
|
||
|
||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#ifndef _BALLSEARCH_ | ||
#define _BALLSEARCH_ | ||
|
||
#include <ros/ros.h> | ||
|
||
#include "traitement.hpp" | ||
#include "analyse.hpp" | ||
#include "std_msgs/Bool.h" | ||
|
||
|
||
class BallSearch | ||
{ | ||
|
||
private: | ||
|
||
//Subscrbers | ||
ros::Subscriber subscriberCommandBusy; | ||
|
||
//Publishers | ||
ros::Publisher publisherBallReference; | ||
|
||
//Messages | ||
std_msgs::Bool command_busy; | ||
|
||
|
||
|
||
public: | ||
|
||
BallSearch(ros::NodeHandle& node); | ||
~BallSearch(); | ||
|
||
void sendBallReference(const float linearVelocity, const float angularVelocity, const float distance, const float angle); | ||
void callbackCommandBusy(const std_msgs::Bool& msg); | ||
Objet * Recherche_balle(unsigned char* raw, int width, int height, int couleur); | ||
void attente(int nsec, int sec); | ||
|
||
|
||
|
||
|
||
|
||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#ifndef _GRAPHICSERVER_ | ||
#define _GRAPHICSERVER_ | ||
|
||
#include <ros/ros.h> | ||
#include <string> | ||
#include "sensor_msgs/Image.h" | ||
|
||
class GraphicServer | ||
{ | ||
|
||
public: | ||
GraphicServer(ros::NodeHandle node,const std::string& topic); | ||
void sendImageDisplay(sensor_msgs::Image imageMsg); | ||
|
||
private: | ||
ros::Publisher publisherImageDisplay; | ||
|
||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#ifndef _TURTLEBOT_ | ||
#define _TURTLEBOT_ | ||
|
||
#include <ros/ros.h> | ||
#include <string> | ||
#include <vector> | ||
#include "sensor_msgs/Image.h" | ||
#include "sensor_msgs/JointState.h" | ||
#include "geometry_msgs/Twist.h" | ||
#include "kobuki_msgs/Sound.h" | ||
|
||
//Constantes | ||
const int SOUND_ON = 0; | ||
const int SOUND_OFF = 1; | ||
const int SOUND_RECHARGE = 2; | ||
const int SOUND_BUTTON = 3; | ||
const int SOUND_ERROR = 4; | ||
const int SOUND_CLEANINGSTART = 5; | ||
const int SOUND_CLEANINGEND = 6; | ||
|
||
const float LINEAR_MAX_VELOCITY = 0.25; | ||
const float ANGULAR_MAX_VELOCITY = 2; | ||
|
||
const int CAMERA_WIDTH = 640; | ||
const int CAMERA_HEIGHT = 480; | ||
const int CAMERA_CHANNELS = 3; | ||
const int CAMERA_STEP_RGB = CAMERA_WIDTH * CAMERA_CHANNELS; | ||
const int CAMERA_STEP_MONO = CAMERA_WIDTH; | ||
|
||
const float ROBOT_MAX_LINEAR_VELOCITY = 0.5f; | ||
const float ROBOT_MAX_ANGULAR_VELOCITY = 3.14f; | ||
|
||
class TurtleBot | ||
{ | ||
|
||
private: | ||
|
||
//Subscrbers | ||
ros::Subscriber subscriberCameraRgbImageColor; | ||
ros::Subscriber subscriberJointStates; | ||
|
||
//Publishers | ||
ros::Publisher publisherMobileBaseCommandsVelocity; | ||
ros::Publisher publisherMobileBaseCommandsSound; | ||
|
||
//Messages | ||
sensor_msgs::Image cameraRgbImageColor; | ||
unsigned char* cameraRgbImageColorRaw; | ||
std::vector<unsigned char> cameraRgbImageColorVec; | ||
|
||
kobuki_msgs::Sound mobileBaseCommandsSound; | ||
geometry_msgs::Twist mobileBaseCommandsVelocity; | ||
sensor_msgs::JointState JointStates; | ||
|
||
ros::NodeHandle& m_node; | ||
public: | ||
|
||
TurtleBot(ros::NodeHandle& node); | ||
~TurtleBot(); | ||
|
||
//Getters | ||
sensor_msgs::Image getCameraRgbImageColor(); | ||
unsigned char* getCameraRgbImageColorRaw(); | ||
|
||
//Setters | ||
void setMobileBaseCommandsSound(const int sound); | ||
|
||
//Image conversion | ||
unsigned char* convertSensor_msgsImageToRaw(const sensor_msgs::Image& sensorMsgsImage); | ||
sensor_msgs::Image convertRawToSensorMsgsImage(const unsigned char* raw, const int height, const int width, const std::string&encoding, const char is_bigendian, const int step); | ||
|
||
//Displays | ||
void displaySensorMsgsImage(const std::string& type, const sensor_msgs::Image& sensorMsgsImage); | ||
void displayMobileBaseCommandsVelocity(); | ||
void displayMobileBaseCommandsSound(); | ||
|
||
//Motion | ||
void stop(); | ||
void move(const float linearVelocity); | ||
void turn(const float angularVelocity); | ||
|
||
void moveAndTurn(const float linearVelocity, const float angularVelocity); | ||
|
||
private: | ||
geometry_msgs::Twist getMobileBaseCommandsVelocity(); | ||
void setMobileBaseCommandsVelocity(const float linearX, const float linearY, const float linearZ, const float angularX, const float angularY, const float angularZ); | ||
|
||
// simple callback to receive image from camera | ||
void callbackCameraRgbImageColor(const sensor_msgs::Image& msg); | ||
|
||
void callbackJointStates(const sensor_msgs::JointState& msg); | ||
|
||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#ifndef _TURTLEBOTCAMERA_ | ||
#define _TURTLEBOTCAMERA_ | ||
|
||
#include <ros/ros.h> | ||
#include <string> | ||
#include <vector> | ||
#include "sensor_msgs/Image.h" | ||
#include "kobuki_msgs/Sound.h" | ||
|
||
//Constantes | ||
const int SOUND_ON = 0; | ||
const int SOUND_OFF = 1; | ||
const int SOUND_RECHARGE = 2; | ||
const int SOUND_BUTTON = 3; | ||
const int SOUND_ERROR = 4; | ||
const int SOUND_CLEANINGSTART = 5; | ||
const int SOUND_CLEANINGEND = 6; | ||
|
||
|
||
const int CAMERA_WIDTH = 640; | ||
const int CAMERA_HEIGHT = 480; | ||
const int CAMERA_CHANNELS = 3; | ||
const int CAMERA_STEP_RGB = CAMERA_WIDTH * CAMERA_CHANNELS; | ||
const int CAMERA_STEP_MONO = CAMERA_WIDTH; | ||
|
||
|
||
class TurtleBotCamera | ||
{ | ||
|
||
private: | ||
|
||
//Subscrbers | ||
ros::Subscriber subscriberCameraRgbImageColor; | ||
|
||
//Publishers | ||
ros::Publisher publisherMobileBaseCommandsSound; | ||
|
||
//Messages | ||
sensor_msgs::Image cameraRgbImageColor; | ||
unsigned char* cameraRgbImageColorRaw; | ||
std::vector<unsigned char> cameraRgbImageColorVec; | ||
|
||
kobuki_msgs::Sound mobileBaseCommandsSound; | ||
|
||
ros::NodeHandle& m_node; | ||
public: | ||
|
||
TurtleBotCamera(ros::NodeHandle& node); | ||
~TurtleBotCamera(); | ||
|
||
//Getters | ||
sensor_msgs::Image getCameraRgbImageColor(); | ||
unsigned char* getCameraRgbImageColorRaw(); | ||
|
||
//Setters | ||
void setMobileBaseCommandsSound(const int sound); | ||
|
||
//Image conversion | ||
unsigned char* convertSensor_msgsImageToRaw(const sensor_msgs::Image& sensorMsgsImage); | ||
sensor_msgs::Image convertRawToSensorMsgsImage(const unsigned char* raw, const int height, const int width, const std::string&encoding, const char is_bigendian, const int step); | ||
|
||
//Displays | ||
void displaySensorMsgsImage(const std::string& type, const sensor_msgs::Image& sensorMsgsImage); | ||
void displayMobileBaseCommandsSound(); | ||
|
||
|
||
private: | ||
|
||
// simple callback to receive image from camera | ||
void callbackCameraRgbImageColor(const sensor_msgs::Image& msg); | ||
|
||
}; | ||
|
||
#endif |
Oops, something went wrong.