37 #include <atlasmv_base/AtlasmvMotionCommand.h>
46 atlasmv_base::AtlasmvMotionCommand
command;
55 atlasmv_base::AtlasmvMotionCommand command_local;
60 command_local.speed=0.2;
61 command_local.lifetime=INFINITY;
62 command_local.priority=1;
63 command_local.header.stamp=ros::Time::now();
69 command_local.speed=0.0;
70 command_local.lifetime=0.1;
71 command_local.priority=1;
72 command_local.header.stamp=ros::Time::now();
83 double speed=(((double)(value)/32768. + 1)/2);
91 cout<<
"speed: "<<speed<<endl;
95 command.header.stamp=ros::Time::now();
113 double dir=((double)(-value)/32768.);
124 command.header.stamp=ros::Time::now();
133 command.header.stamp=ros::Time::now();
143 command.header.stamp=ros::Time::now();
152 init(argc,argv,
"atlasmv_command_publisher");
158 char*dev=(
char*)malloc(1024*
sizeof(
char));
161 nh.param(
"maximum_dir", parameters.
maximum_dir,0.355);
162 nh.param(
"minimum_dir", parameters.
minimum_dir,-0.38);
165 nh.param(
"device_gamepad",dev_s,(std::string)
"/dev/input/js0");
167 strcpy(dev,dev_s.c_str());
169 cout<<endl<<
"Gamepad device: "<<dev_s<<endl;
201 commandPublisher = nh.advertise<atlasmv_base::AtlasmvMotionCommand>(
"/atlasmv/base/motion", 1000);
Publisher commandPublisherPtr
Gamepad communication class declaration generic code.
void GamepadDisconnect(int value, void *userdata)
void GamepadZeroSteering(int value, void *userdata)
c_atlasmv.h file for this module. Includes, global vars, function prototypes, etc.
void plerr(int ret)
Print local error function This function prints the error present in the err variable (this is a priv...
int Dispatch(bool debug=false)
This function checks the gamepad status and calls the respective callback.
void GamepadReverse(int value, void *parameters)
Publisher commandPublisher
atlasmv_base::AtlasmvMotionCommand command
int main(int argc, char **argv)
void GamepadSpeed(int value, void *userdata)
void GamepadDir(int value, void *userdata)
double max_backward_speed
int RegisterCallback(e_type type, int id, void(*callback)(int value, void *data), void *data)
Register a callback for a specific button or axis.
void GamepadSearch(int value, void *parameters)
typedef that includes all params that define atlasmv robot
int StartComm(const char *device)
Initialize comm with the gamepad.