8 #include "std_msgs/Float64.h" 10 #define PUB_RATE 100.0 12 #define CONST_V_TIME 3.0 15 int main(
int argc,
char **argv)
43 double angle_cmd = 0.0;
46 std_msgs::Float64 msg;
48 double delta_s = 0.000628 / (
PUB_RATE / 100.0) * 4;
52 double cmd_before_dec = 0.0;
56 ROS_ERROR(
"No DOF parameter specified! Could not give the right command");
68 acc_t = 1.0 / PUB_RATE * i;
69 angle_cmd = - 0.5 * (acc) * (acc_t) * (acc_t);
74 angle_cmd = angle_cmd + dir * delta_s;
76 cmd_before_dec = angle_cmd;
82 angle_cmd = cmd_before_dec - const_v * acc_t + 0.5 * (acc) * (acc_t) * (acc_t);
105 msg.data = -msg.data;
106 angle4_pub.publish(msg);
107 msg.data = -msg.data;
109 angle2_pub.publish(msg);
112 msg.data = msg.data * 2;
116 angle5_pub.publish(msg);
121 angle3_pub.publish(msg);
123 angle6_pub.publish(msg);
125 angle7_pub.publish(msg);
132 angle3_pub.publish(msg);
134 angle2_pub.publish(msg);
137 msg.data = msg.data * 2;
141 angle4_pub.publish(msg);
146 angle5_pub.publish(msg);
148 angle6_pub.publish(msg);
155 angle3_pub.publish(msg);
157 angle2_pub.publish(msg);
160 msg.data = msg.data * 2;
167 angle4_pub.publish(msg);
169 angle5_pub.publish(msg);
176 ROS_ERROR(
"DOF parameter not correct, please check!");
188 fprintf(stderr,
"ROS::OK() false \n" );
void publish(const boost::shared_ptr< M > &message) const
int main(int argc, char **argv)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
bool getParam(const std::string &key, std::string &s) const
bool hasParam(const std::string &key) const
ROSCPP_DECL void spinOnce()