10 #define CMD_SERVER_HPP 13 #include <sys/socket.h> 14 #include <netinet/in.h> 19 #include "marty_msgs/Command.h" 20 #include "marty_msgs/ServoMsg.h" 21 #include "marty_msgs/ServoMsgArray.h" 26 #include "std_msgs/Float32.h" 27 #include "geometry_msgs/Pose2D.h" 28 #include "marty_msgs/GPIOs.h" 29 #include "marty_msgs/Accelerometer.h" 30 #include "marty_msgs/MotorCurrents.h" 35 #define stop_wait 150 // Wait time between instantaneous servo commands 103 void arms(
int r_angle = 0,
int l_angle = 0);
105 void dance(
int robot_id);
107 void eyes(
int amount = 0,
int amount2 = 0);
108 void getData(
int sensor,
int id);
111 void lean(
int dir,
int amount = 100,
int move_time = 2000);
112 void liftLeg(
int leg,
int amount = 100,
int move_time = 2000);
113 void lowerLeg(
int move_time = 1000);
114 void moveJoint(
int side,
int joint,
int amount,
int move_time = 2000);
115 void sideStep(
int side,
int num_steps = 1,
int move_time = 1000,
116 int step_length = 50);
121 void walk(
int num_steps = 2,
int turn = 0,
122 int move_time = 3000,
int step_length = 50,
int side = -1);
124 void testLeg(
int side,
int duration);
126 void swingArms(
int r_arm,
int l_arm,
int duration = 2000,
int cycles = 4);
127 void swingJoints(marty_msgs::ServoMsgArray,
int duration = 2000,
135 bool cmd_service(marty_msgs::Command::Request& req,
136 marty_msgs::Command::Response& res);
void sideStep(int side, int num_steps=1, int move_time=1000, int step_length=50)
void arms(int r_angle=0, int l_angle=0)
void sitBack(int duration)
geometry_msgs::Pose2D ball_pos_
ros::Subscriber curr_sub_
void moveJoint(int side, int joint, int amount, int move_time=2000)
void playSound(int freq=440, int duration=500)
void liftLeg(int leg, int amount=100, int move_time=2000)
void walk(int num_steps=2, int turn=0, int move_time=3000, int step_length=50, int side=-1)
std::vector< int > cmd_data_
void swingArms(int r_arm, int l_arm, int duration=2000, int cycles=4)
ros::ServiceServer cmd_srv_
void runCommand(vector< int > data)
Runs commands received by the server.
void accelCB(const marty_msgs::Accelerometer &msg)
marty_msgs::MotorCurrents curr_data_
void ballCB(const geometry_msgs::Pose2D &msg)
Marty Core header providing access to Marty methods.
CmdServer(ros::NodeHandle &nh)
ros::Subscriber batt_sub_
void celebrate(int move_time=4000)
ros::Subscriber gpio_sub_
marty_msgs::Accelerometer accel_data_
void eyes(int amount=0, int amount2=0)
ros::Subscriber ball_sub_
void testLeg(int side, int duration)
std_msgs::Float32 batt_data_
void runSockCommand(vector< int8_t > data)
bool cmd_service(marty_msgs::Command::Request &req, marty_msgs::Command::Response &res)
void getData(int sensor, int id)
std::vector< std::vector< int > > cmd_queue_
void kick(int side=CMD_LEFT, int move_time=3000)
void swingJoints(marty_msgs::ServoMsgArray, int duration=2000, int cycles=4)
void currCB(const marty_msgs::MotorCurrents &msg)
void playSounds(std::vector< int > sounds)
void standStraight(int move_time=1000)
void battCB(const std_msgs::Float32 &msg)
marty_msgs::GPIOs gpio_data_
Direction
Add new commands here for the server to receive.
void gpioCB(const marty_msgs::GPIOs &msg)
void lean(int dir, int amount=100, int move_time=2000)
void robotReady()
Robot motion executed when cmdServer is ready.
ros::Subscriber accel_sub_
void lowerLeg(int move_time=1000)