本文整理汇总了C++中actionlib::SimpleActionServer::start方法的典型用法代码示例。如果您正苦于以下问题:C++ SimpleActionServer::start方法的具体用法?C++ SimpleActionServer::start怎么用?C++ SimpleActionServer::start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类actionlib::SimpleActionServer
的用法示例。
在下文中一共展示了SimpleActionServer::start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BTAction
explicit BTAction(std::string name) :
as_(nh_, name, boost::bind(&BTAction::execute_callback, this, _1), false),
action_name_(name)
{
// Starts the action server
as_.start();
}
示例2: OrientToLaserReadingAction
OrientToLaserReadingAction(ros::NodeHandle nh, std::string name, std::string cmd_vel_topic, std::string linreg_service_name) :
as_(nh, name, boost::bind(&OrientToLaserReadingAction::executeActionCB, this, _1), false)
{
//as_.registerGoalCallback();
this->action_name_ = name;
this->service_name = linreg_service_name;
this->cmd_vel_topic = cmd_vel_topic;
nh_ = nh;
target_distance = TARGET_DISTANCE;
max_velocity = MAX_VELOCITY;
ROS_INFO("Register publisher");
cmd_pub = nh_.advertise<geometry_msgs::Twist>(cmd_vel_topic, 1000); // 1000-element buffer for publisher
ROS_INFO("Create service clinet");
client = nh_.serviceClient<BaseScanLinearRegression>(service_name);
as_.start();
}
示例3: BlockLogicServer
BlockLogicServer(const std::string name) :
nh_("~"),
interactive_m_server_("block_controls"),
action_server_(name, false),
action_name_(name),
initialized_(false),
block_size(0.4)
{
// Load parameters from the server.
nh_.param<double>("bump_size", bump_size, 0.0); // original 0.005
// ---------------------------------------------------------------------------------------------
// Read in all seen blocks
block_sub_ = nh_.subscribe("/cube_block_poses", 1, &BlockLogicServer::addBlocks, this);
// ---------------------------------------------------------------------------------------------
// Publish location of blocks??
pick_place_pub_ = nh_.advertise< geometry_msgs::PoseArray >("/pick_place", 1, true);
// ---------------------------------------------------------------------------------------------
// Rviz Visualizations
marker_pub_ = nh_.advertise<visualization_msgs::Marker>("visualization_marker", 1);
// ---------------------------------------------------------------------------------------------
// Register the goal and feeback callbacks for action server
action_server_.registerGoalCallback(boost::bind(&BlockLogicServer::goalCB, this));
action_server_.registerPreemptCallback(boost::bind(&BlockLogicServer::preemptCB, this));
action_server_.start();
}
示例4: Node
Node()
: private_nh("~"),
kill_listener(boost::bind(&Node::killed_callback, this)),
actionserver(nh, "moveto", false),
disabled(false) {
fixed_frame = uf_common::getParam<std::string>(private_nh, "fixed_frame");
body_frame = uf_common::getParam<std::string>(private_nh, "body_frame");
limits.vmin_b = uf_common::getParam<subjugator::Vector6d>(private_nh, "vmin_b");
limits.vmax_b = uf_common::getParam<subjugator::Vector6d>(private_nh, "vmax_b");
limits.amin_b = uf_common::getParam<subjugator::Vector6d>(private_nh, "amin_b");
limits.amax_b = uf_common::getParam<subjugator::Vector6d>(private_nh, "amax_b");
limits.arevoffset_b = uf_common::getParam<Eigen::Vector3d>(private_nh, "arevoffset_b");
limits.umax_b = uf_common::getParam<subjugator::Vector6d>(private_nh, "umax_b");
traj_dt = uf_common::getParam<ros::Duration>(private_nh, "traj_dt", ros::Duration(0.0001));
odom_sub = nh.subscribe<Odometry>("odom", 1, boost::bind(&Node::odom_callback, this, _1));
trajectory_pub = nh.advertise<PoseTwistStamped>("trajectory", 1);
waypoint_pose_pub = private_nh.advertise<PoseStamped>("waypoint", 1);
update_timer =
nh.createTimer(ros::Duration(1. / 50), boost::bind(&Node::timer_callback, this, _1));
actionserver.start();
set_disabled_service = private_nh.advertiseService<SetDisabledRequest, SetDisabledResponse>(
"set_disabled", boost::bind(&Node::set_disabled, this, _1, _2));
}
示例5: followerAction
followerAction(std::string name) :
action_(nh_, name, boost::bind(&followerAction::executeCB, this, _1), false),
action_name_(name)
{
action_.start();
ROS_INFO("Waiting for the Client to start the process");
}
示例6: TestAction
TestAction(std::string name) :
as_(nh_, name, boost::bind(&TestAction::executeCB, this, _1), false),
action_name_(name)
{
twist_pub = nh_.advertise<geometry_msgs::Twist>("/cmd_vel", 1000);
dist_sub = nh_.subscribe("/ir_publish/sensors", 1, &TestAction::distanceCallback, this);
distance_lefts_front = init_side_limit_max;
distance_lefts_back = init_side_limit_max;
distance_front_left = init_front_limit_max;
distance_front_right = init_front_limit_max;
distance_rights_front = init_side_limit_max;
distance_rights_back = init_side_limit_max;
// Coresponding to the right decision side
side = 0;
flagReady = 0;
srand(time(NULL));
state = FRONT;
counter = 0;
as_.start();
}
示例7: MotorController
MotorController(int hz) : ignore_twist(false), ignored_twist_cnt(0), Node(), hz(hz), wheel_left(hz), wheel_right(hz), v(0), w(0), updates_since_last_twist(0), idle(false), is_still(false), stop_action(nh, ACTION_STOP, boost::bind(&MotorController::action_execute_stop_callback, this, _1), false), is_stopping(false) {
init_params();
print_params();
pwm_publisher = nh.advertise<ras_arduino_msgs::PWM>(TOPIC_PWM, BUFFER_SIZE);
actual_twist_publisher = nh.advertise<geometry_msgs::Twist>(TOPIC_ACTUAL_TWIST, BUFFER_SIZE);
twist_subscriber = nh.subscribe<geometry_msgs::Twist>(TOPIC_TWIST, BUFFER_SIZE, &MotorController::twist_callback, this);
encoders_subscriber = nh.subscribe<ras_arduino_msgs::Encoders>(TOPIC_ENCODERS, BUFFER_SIZE, &MotorController::encoders_callback, this);
stop_action.start();
}
开发者ID:group-8-robotics-of-destruction,项目名称:s8_motor_controller,代码行数:9,代码来源:motor_controller_node.cpp
示例8: PickAndPlaceServer
PickAndPlaceServer(const std::string name) :
nh_("~"), as_(name, false), action_name_(name), client_("/move_arm", true)
{
//register the goal and feeback callbacks
as_.registerGoalCallback(boost::bind(&PickAndPlaceServer::goalCB, this));
as_.registerPreemptCallback(boost::bind(&PickAndPlaceServer::preemptCB, this));
as_.start();
}
示例9: exception
ExpressionDriver(std::string name, ros::NodeHandle &n) : nh_(n), nPriv("~"), as_(nh_, name, boost::bind(&ExpressionDriver::executeCB, this, _1), false),
action_name_()
{
//Initialize the port
nPriv.param<std::string>("port", port, "/dev/ttyACM0");
nPriv.param<int>("baudrate", baudrate, 115200);
try
{
driverComms = new DriverComms(port, baudrate);
}
catch(const std::exception&)
{
throw std::exception();
}
//Start the action server
as_.start();
//Initialize and set the default expression
bool sentM, sentS, sentR, sentL;
sentM = driverComms->sendCommand(ExpressionValues::ExpressionHappy::MOUTH, vizzy_expressions::ExpressionActionGoal::_goal_type::PART_MOUTH);
feedback_.mouth_value = ExpressionValues::ExpressionHappy::MOUTH;
feedback_.mouth_emotion = vizzy_expressions::ExpressionActionGoal::_goal_type::FACE_HAPPY;
sentS = driverComms->sendCommand(ExpressionValues::ExpressionHappy::EYELIDS, vizzy_expressions::ExpressionActionGoal::_goal_type::PART_EYELIDS);
feedback_.eyelids_emotion = vizzy_expressions::ExpressionActionGoal::_goal_type::FACE_HAPPY;
feedback_.eyelids_value = ExpressionValues::ExpressionHappy::EYELIDS;
sentR = driverComms->sendCommand(ExpressionValues::ExpressionHappy::RIGHT_EYEBROW, vizzy_expressions::ExpressionActionGoal::_goal_type::PART_RIGHTEYEBROW);
feedback_.rightEyebrow_emotion = vizzy_expressions::ExpressionActionGoal::_goal_type::FACE_HAPPY;
feedback_.rightEyebrow_value = ExpressionValues::ExpressionHappy::RIGHT_EYEBROW;
sentL = driverComms->sendCommand(ExpressionValues::ExpressionHappy::LEFT_EYEBROW, vizzy_expressions::ExpressionActionGoal::_goal_type::PART_LEFTEYEBROW);
feedback_.leftEyebrow_emotion = vizzy_expressions::ExpressionActionGoal::_goal_type::FACE_HAPPY;
feedback_.leftEyebrow_value = ExpressionValues::ExpressionHappy::LEFT_EYEBROW;
if(sentM && sentS && sentR && sentL)
{
ROS_INFO("Initialization commands sent. Vizzy is Happy! :D");
}
else
{
ROS_ERROR("Expression initialization failed. Check the board? :(");
as_.shutdown();
delete driverComms;
throw std::exception();
}
}
示例10: MovePlatformAction
MovePlatformAction() :
as_(n_, CARLOS_MOVE_ACTION, false), //movePlatform action SERVER
ac_planner_("/plan_action", true), // Planner action CLIENT
ac_control_("/control_action", true) // Controller action CLIENT
{
n_.param("/move_platform_server/debug", debug_, false);
std::string name = ROSCONSOLE_DEFAULT_NAME; //ros.carlos_motion_action_server
name = name + ".debug";
logger_name_ = "debug";
//logger is ros.carlos_motion_action_server.debug
if (debug_)
{
// if we use ROSCONSOLE_DEFAULT_NAME we'll get a ton of debug messages from actionlib which is annoying!!!
// so for debug we'll use a named logger
if(ros::console::set_logger_level(name, ros::console::levels::Debug)) //name
ros::console::notifyLoggerLevelsChanged();
}
else // if not DEBUG we want INFO
{
if(ros::console::set_logger_level(name, ros::console::levels::Info)) //name
ros::console::notifyLoggerLevelsChanged();
}
ROS_DEBUG_NAMED(logger_name_, "Starting Move Platform Server");
as_.registerGoalCallback(boost::bind(&MovePlatformAction::moveGoalCB, this));
as_.registerPreemptCallback(boost::bind(&MovePlatformAction::movePreemptCB, this));
//start the move server
as_.start();
ROS_DEBUG_NAMED(logger_name_, "Move Platform Action Server Started");
// now wait for the other servers (planner + controller) to start
ROS_WARN_NAMED(logger_name_, "Waiting for planner server to start");
ac_planner_.waitForServer();
ROS_INFO_STREAM_NAMED(logger_name_, "Planner server started: " << ac_planner_.isServerConnected());
ROS_WARN_NAMED(logger_name_, "Waiting for controller server to start");
ac_control_.waitForServer();
ROS_INFO_STREAM_NAMED(logger_name_, "Controller server started: " << ac_control_.isServerConnected());
n_.param("/carlos/fsm_frequency", frequency_, DEFAULT_STATE_FREQ);
state_pub_timer_ = n_.createTimer(frequency_, &MovePlatformAction::state_pub_timerCB, this);
state_pub_ = n_.advertise<mission_ctrl_msgs::hardware_state>(CARLOS_BASE_STATE_MSG,1);
planning_ = false;
controlling_ = false;
//set_terminal_state_;
ctrl_state_sub = n_.subscribe<std_msgs::String>("/oea_controller/controller_state", 5, &MovePlatformAction::control_stateCB, this);
planner_state_sub = n_.subscribe<std_msgs::UInt8>("/oea_planner/state", 5, &MovePlatformAction::planner_stateCB, this);
}
示例11:
Trajectory_Tracker(ros::NodeHandle n) :
action_server(n,ros::this_node::getName(),boost::bind(&Trajectory_Tracker::track_trajectory, this, _1), false),
action_name(ros::this_node::getName())
{
action_server.start();
ROS_INFO("STARTED ACTION SERVER");
marker_pub = n.advertise<visualization_msgs::Marker>("visualization_marker", 10);
cmd_pub = n.advertise<geometry_msgs::Pose2D>("cmd", 1000);
Kp_x = 1;
Kp_y = 4;
Kp_w = 1.75;
}
示例12: SpinBucketAction
SpinBucketAction(std::string name) :
as_(nh_, name, boost::bind(&SpinBucketAction::executeCB, this, _1), false),
action_name_(name)
{
// register the goal and feeback callbacks
point_sub_ = nh_.subscribe("/track_bucket_point_avg", 1, &SpinBucketAction::trackBucketPointCB, this);
ir_sub_ = nh_.subscribe("/beacon", 1, &SpinBucketAction::trackIRCB, this);
twist_pub_ = nh_.advertise<geometry_msgs::Twist>("/cmd_vel", 1);
bucket_detected_=false;
ir_detected_=false;
entered_ir = false;
as_.start();
}
示例13: PickAndPlaceServer
PickAndPlaceServer(const std::string name) :
nh_("~"), as_(name, false), action_name_(name), client_("/move_right_arm", true)
{
//register the goal and feeback callbacks
as_.registerGoalCallback(boost::bind(&PickAndPlaceServer::goalCB, this));
as_.registerPreemptCallback(boost::bind(&PickAndPlaceServer::preemptCB, this));
as_.start();
client_.waitForServer();
ROS_INFO("Connected to server");
gripper = nh_.advertise<std_msgs::Float64>("/parallel_gripper_controller/command", 1, false);
}
示例14: ApproachBucketAction
ApproachBucketAction(std::string name) :
as_(nh_, name, false),
action_name_(name)
{
// register the goal and feeback callbacks
as_.registerGoalCallback(boost::bind(&ApproachBucketAction::goalCB, this));
as_.registerPreemptCallback(boost::bind(&ApproachBucketAction::preemptCB, this));
twist_pub_ = nh_.advertise<geometry_msgs::Twist>("/cmd_vel", 1);
us_sub_ = nh_.subscribe("/obstacle", 1, &ApproachBucketAction::ultraSonicsCB, this);
point_sub_ = nh_.subscribe("track_bucket_point_avg", 1, &ApproachBucketAction::trackPointCB, this);
area_sub_ = nh_.subscribe("track_bucket_area", 1, &ApproachBucketAction::trackAreaCB, this);
obstacle_detected_=false;
drop_flag = false;
as_.start();
}
示例15: DynamixelProActionServer
DynamixelProActionServer(std::string name): _actionServer(_nodeHandle, name, boost::bind(&DynamixelProActionServer::goalCallback, this, _1) ,false) {
_actionServer.registerPreemptCallback(boost::bind(&DynamixelProActionServer::preemptCallback, this));
if(_nodeHandle.getParam("joint_name_list", _jointInfo.name)) {
init();
_publishFeedback = false;
_jointState = _nodeHandle.subscribe("joint_states", 100, &DynamixelProActionServer::jointStateCallback,
this);
_jointCommand = _nodeHandle.advertise<sensor_msgs::JointState>("joint_commands", 10);
_actionServer.start();
rosInfo("Server is active");
}
else {
rosError("Cloud not find joint_name_list parameter");
ros::shutdown();
}
}