11 #include <geometry_msgs/Twist.h> 12 #include "sensor_msgs/JointState.h" 13 #include "hebiros/AddGroupFromNamesSrv.h" 44 double wheelRadius = 0.0762;
45 double baseRadius = 0.235;
47 double wheelRotSpeed =
M_PI/3;
48 double ratio =
sqrt(3)/2;
52 directions.linear.y * speed * -ratio/wheelRadius +
53 directions.angular.z * wheelRotSpeed * baseRadius/wheelRadius;
57 directions.linear.y * speed * ratio/wheelRadius +
58 directions.angular.z *wheelRotSpeed * baseRadius/wheelRadius;
63 directions.angular.z * wheelRotSpeed * baseRadius/wheelRadius;
79 int main(
int argc,
char ** argv) {
82 ros::init(argc, argv,
"example_omnibase_free_roam");
95 std::string group_name =
"omniGroup";
99 "/hebiros/add_group_from_names");
108 "/hebiros/"+group_name+
"/command/joint_state", 100);
111 AddGroupFromNamesSrv add_group_srv;
112 add_group_srv.request.group_name = group_name;
113 add_group_srv.request.names = {
"_Wheel1",
"_Wheel2",
"_Wheel3"};
114 add_group_srv.request.families = {
"Rosie"};
117 while(!add_group_client.
call(add_group_srv)) {}
119 sensor_msgs::JointState command_msg;
120 command_msg.name.push_back(
"Rosie/_Wheel1");
121 command_msg.name.push_back(
"Rosie/_Wheel2");
122 command_msg.name.push_back(
"Rosie/_Wheel3");
124 command_msg.velocity.resize(3);
125 command_msg.position.resize(3);
134 bool startup_complete =
false;
137 if ( !startup_complete ) {
143 startup_complete =
true;
156 command_msg.velocity[0] =
omniVels[0];
157 command_msg.velocity[1] =
omniVels[1];
158 command_msg.velocity[2] =
omniVels[2];
164 command_msg.position[0] =
omniPos[0];
165 command_msg.position[1] =
omniPos[1];
166 command_msg.position[2] =
omniPos[2];
169 command_publisher.
publish(command_msg);
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
std::array< double, 3 > omniPos
void publish(const boost::shared_ptr< M > &message) const
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
EIGEN_DEVICE_FUNC const SqrtReturnType sqrt() const
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool call(MReq &req, MRes &res)
geometry_msgs::Twist directions
void feedback_callback(sensor_msgs::JointState data)
std::array< double, 3 > omniVels
int speed
PARAMETERS ##########.
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
int main(int argc, char **argv)
void directions_callback(geometry_msgs::Twist data)
sensor_msgs::JointState feedback
ROSCPP_DECL void spinOnce()