#include "ros/ros.h"
#include <stdio.h>
#include <phidget21.h>
#include "corobot_srvs/GetEngaged.h"
#include "corobot_srvs/SetEngaged.h"
#include "corobot_srvs/GetPosition.h"
#include "corobot_srvs/SetPosition.h"
#include "corobot_srvs/GetMotorCount.h"
#include "corobot_srvs/SetParam.h"
#include "corobot_msgs/ServoPosition.h"
#include "corobot_srvs/GetSerialNumber.h"
#include "corobot_srvs/GetType.h"
#include "corobot_srvs/SetType.h"
#include "corobot_msgs/ServoType.h"
#include <diagnostic_updater/diagnostic_updater.h>
#include <diagnostic_updater/publisher.h>
Go to the source code of this file.
Functions | |
int | ErrorHandler (CPhidgetHandle SERV, void *userptr, int ErrorCode, const char *Description) |
Phidget error Callback. | |
bool | GetEngaged (corobot_srvs::GetEngaged::Request &req, corobot_srvs::GetEngaged::Response &res) |
Get the status of a servo motor connected, to know if it is engaged ( powered on) or not. | |
bool | GetMotorCount (corobot_srvs::GetMotorCount::Request &req, corobot_srvs::GetMotorCount::Response &res) |
Get the maximum number of servo motors that can be connected to this Phidget Servo controller. | |
bool | GetPosition (corobot_srvs::GetPosition::Request &req, corobot_srvs::GetPosition::Response &res) |
Get the position of a servo motor. | |
bool | GetPositionMax (corobot_srvs::GetPosition::Request &req, corobot_srvs::GetPosition::Response &res) |
Get the maximum position possible of a servo motor. | |
bool | GetPositionMin (corobot_srvs::GetPosition::Request &req, corobot_srvs::GetPosition::Response &res) |
Get the minumum position possible of a servo motor. | |
bool | GetSerialNumber (corobot_srvs::GetSerialNumber::Request &req, corobot_srvs::GetSerialNumber::Response &res) |
Get the serial number of the current phidget servo controller. Useful if there are two phidget servo controllers connected. | |
bool | GetServoType (corobot_srvs::GetType::Request &req, corobot_srvs::GetType::Response &res) |
Get the type of servo motor pluged in. | |
int | main (int argc, char *argv[]) |
int | PositionChangeHandler (CPhidgetAdvancedServoHandle phid, void *userPtr, int index, double position) |
Each time a servo motor changes position, this function is called and a message is publish on the /phidgetServo_getPosition topic. | |
void | servo_diagnostic (diagnostic_updater::DiagnosticStatusWrapper &stat) |
bool | SetEngaged (corobot_srvs::SetEngaged::Request &req, corobot_srvs::SetEngaged::Response &res) |
Set the status of a servo motor, engaged( powered on) or not. | |
bool | SetPosition (corobot_srvs::SetPosition::Request &req, corobot_srvs::SetPosition::Response &res) |
Set the position of a servo motor. | |
void | setPositionCallback (const corobot_msgs::ServoPosition &msg) |
Callback for the topic /phidgetServo_setPosition The position of the concerned servo motor is set each time a message is received on this topic. | |
bool | SetServoParameters (corobot_srvs::SetParam::Request &req, corobot_srvs::SetParam::Response &res) |
Get the parameters of a servo motor. | |
bool | SetServoType (corobot_srvs::SetType::Request &req, corobot_srvs::SetType::Response &res) |
Set the servo motor to one of the defined types. | |
void | setTypeCallback (const corobot_msgs::ServoType &msg) |
Callback for the topic /phidgetServo_setType The type of the concerned servo motor is set each time a message is received on this topic. | |
Variables | |
ros::Publisher | position_pub |
CPhidgetAdvancedServoHandle | servo = 0 |
int | servoError = 0 |
int ErrorHandler | ( | CPhidgetHandle | SERV, |
void * | userptr, | ||
int | ErrorCode, | ||
const char * | Description | ||
) |
Phidget error Callback.
Definition at line 151 of file PhidgetServo.cpp.
bool GetEngaged | ( | corobot_srvs::GetEngaged::Request & | req, |
corobot_srvs::GetEngaged::Response & | res | ||
) |
Get the status of a servo motor connected, to know if it is engaged ( powered on) or not.
corobot_srvs::GetEngaged | Service |
Definition at line 29 of file PhidgetServo.cpp.
bool GetMotorCount | ( | corobot_srvs::GetMotorCount::Request & | req, |
corobot_srvs::GetMotorCount::Response & | res | ||
) |
Get the maximum number of servo motors that can be connected to this Phidget Servo controller.
Pcorobot_srvs::GetMotorCount | Service |
Definition at line 73 of file PhidgetServo.cpp.
bool GetPosition | ( | corobot_srvs::GetPosition::Request & | req, |
corobot_srvs::GetPosition::Response & | res | ||
) |
Get the position of a servo motor.
corobot_srvs::GetPosition | Service |
Definition at line 51 of file PhidgetServo.cpp.
bool GetPositionMax | ( | corobot_srvs::GetPosition::Request & | req, |
corobot_srvs::GetPosition::Response & | res | ||
) |
Get the maximum position possible of a servo motor.
corobot_srvs::GetPosition | Service |
Definition at line 86 of file PhidgetServo.cpp.
bool GetPositionMin | ( | corobot_srvs::GetPosition::Request & | req, |
corobot_srvs::GetPosition::Response & | res | ||
) |
Get the minumum position possible of a servo motor.
corobot_srvs::GetPosition | Service |
Definition at line 99 of file PhidgetServo.cpp.
bool GetSerialNumber | ( | corobot_srvs::GetSerialNumber::Request & | req, |
corobot_srvs::GetSerialNumber::Response & | res | ||
) |
Get the serial number of the current phidget servo controller. Useful if there are two phidget servo controllers connected.
corobot_srvs::GetSerialNumber | Service |
Definition at line 161 of file PhidgetServo.cpp.
bool GetServoType | ( | corobot_srvs::GetType::Request & | req, |
corobot_srvs::GetType::Response & | res | ||
) |
Get the type of servo motor pluged in.
corobot_srvs::GetType | Service |
Definition at line 174 of file PhidgetServo.cpp.
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 229 of file PhidgetServo.cpp.
int PositionChangeHandler | ( | CPhidgetAdvancedServoHandle | phid, |
void * | userPtr, | ||
int | index, | ||
double | position | ||
) |
Each time a servo motor changes position, this function is called and a message is publish on the /phidgetServo_getPosition topic.
Definition at line 120 of file PhidgetServo.cpp.
void servo_diagnostic | ( | diagnostic_updater::DiagnosticStatusWrapper & | stat | ) |
Function that will report the status of the hardware to the diagnostic topic
Definition at line 202 of file PhidgetServo.cpp.
bool SetEngaged | ( | corobot_srvs::SetEngaged::Request & | req, |
corobot_srvs::SetEngaged::Response & | res | ||
) |
Set the status of a servo motor, engaged( powered on) or not.
corobot_srvs::SetEngaged | Service |
Definition at line 42 of file PhidgetServo.cpp.
bool SetPosition | ( | corobot_srvs::SetPosition::Request & | req, |
corobot_srvs::SetPosition::Response & | res | ||
) |
Set the position of a servo motor.
corobot_srvs::SetPosition | Service |
Definition at line 64 of file PhidgetServo.cpp.
void setPositionCallback | ( | const corobot_msgs::ServoPosition & | msg | ) |
Callback for the topic /phidgetServo_setPosition The position of the concerned servo motor is set each time a message is received on this topic.
corobot_msgs::ServoPosition | Message |
Definition at line 137 of file PhidgetServo.cpp.
bool SetServoParameters | ( | corobot_srvs::SetParam::Request & | req, |
corobot_srvs::SetParam::Response & | res | ||
) |
Get the parameters of a servo motor.
corobot_srvs::SetParam | Service |
Definition at line 112 of file PhidgetServo.cpp.
bool SetServoType | ( | corobot_srvs::SetType::Request & | req, |
corobot_srvs::SetType::Response & | res | ||
) |
Set the servo motor to one of the defined types.
corobot_srvs::SetType | Service |
Definition at line 187 of file PhidgetServo.cpp.
void setTypeCallback | ( | const corobot_msgs::ServoType & | msg | ) |
Callback for the topic /phidgetServo_setType The type of the concerned servo motor is set each time a message is received on this topic.
corobot_msgs::ServoType | Message |
Definition at line 197 of file PhidgetServo.cpp.
Definition at line 22 of file PhidgetServo.cpp.
CPhidgetAdvancedServoHandle servo = 0 |
Definition at line 21 of file PhidgetServo.cpp.
int servoError = 0 |
Definition at line 23 of file PhidgetServo.cpp.