次のコンパイラエラーが発生し続けます
/home/armon/Development/groovy_workspace/sandbox/smart_wheelchair/trunk/smart_wheelchair/state_machine_planner/src/BasicControllerState.cpp:1:0 からインクルードされたファイル: /home/armon/Development/groovy_workspace/sandbox/smart_wheelchair/trunk/smart_wheelchair/ state_machine_planner/include/state_machine_planner/BasicControllerState.h:38:49: エラー: '*' トークンの前に ')' が必要です
/home/armon/Development/groovy_workspace/sandbox/smart_wheelchair/trunk/smart_wheelchair/state_machine_planner/src/BasicControllerState.cpp:4:44: エラー: '(' トークンの前にコンストラクタ、デストラクタ、または型変換が必要です /home からインクルードされたファイル内/armon/Development/groovy_workspace/sandbox/smart_wheelchair/trunk/smart_wheelchair/state_machine_planner/include/state_machine_planner/StateMachinePlanner.h:16:0、/home/armon/Development/groovy_workspace/sandbox/smart_wheelchair/trunk/smart_wheelchair/state_machine_planner/src から/ControllerNode.cpp:4: /home/armon/Development/groovy_workspace/sandbox/smart_wheelchair/trunk/smart_wheelchair/state_machine_planner/include/state_machine_planner/BasicControllerState.h:38:49: エラー: ')' が '<em>' の前にあると予想されますトークンの作成[3]: [CMakeFiles/state_machine_planner.dir/src/BasicControllerState.cpp.o] エラー 1 make[3]: *未完了のジョブを待機しています.... /home/armon/Development/groovy_workspace/sandbox/smart_wheelchair/trunk/ から含まれるファイル内smart_wheelchair/state_machine_planner/include/state_machine_planner/StateMachinePlanner.h:16:0、/home/armon/Development/groovy_workspace/sandbox/smart_wheelchair/trunk/smart_wheelchair/state_machine_planner/src/StateMachinePlanner.cpp:1 から: /home/armon/Development /groovy_workspace/sandbox/smart_wheelchair/trunk/smart_wheelchair/state_machine_planner/include/state_machine_planner/BasicControllerState.h:38:49: エラー: '*' トークンの前に ')' が必要です
/home/armon/Development/groovy_workspace/sandbox/smart_wheelchair/trunk/smart_wheelchair/state_machine_planner/src/StateMachinePlanner.cpp: コンストラクター内 'state_machine_planner::StateMachinePlanner::StateMachinePlanner()':
/home/armon/Development/groovy_workspace/sandbox/ smart_wheelchair/trunk/smart_wheelchair/state_machine_planner/src/StateMachinePlanner.cpp:9:30: エラー: '(state_machine_planner::BasicControllerState) (costmap_2d::Costmap2DROS*&)' の呼び出しに一致しません</p>
BasicControllerState は StateMachinePlanner のメンバーです
ここにコードがあります、
BasicControllerState.h (関連部分):
class BasicControllerState {
public:
BasicControllerState(){}
BasicControllerState(costmap_2d::costmap2DROS* costmap_ros);
BasicControllerState.cpp:
#include <state_machine_planner/BasicControllerState.h>
namespace state_machine_planner {
BasicControllerState::BasicControllerState(costmap_2d::costmap2DROS* costmap_ros) {
//init trajectory parameters specific to what state the child class represents
//init sim_time_ and sim_granularity_
//init sample space limits
//init best_score_thresh_
obstacle_dist_cost_gain_ = 0.1;
heading_diff_cost_gain_ = 0.0;
linear_vel_cost_gain_ = 0.0;
omega_cost_gain_ = 0.0;
num_of_linvel_samples_ = 20;
num_of_angvel_smaples_ = 40;
costmap_ros_ = costmap_ros;
costmap_ros_->getCostmapCopy(costmap_);
robot_footprint_ = costmap_ros_->getRobotFootprint();
world_model_ = new base_local_planner::CostmapModel(costmap_);
}
StateMachinePlanner.h:
class StateMachinePlanner
{
public:
StateMachinePlanner();
void init(int latency_command_queue_size, vel_params_struct vps, time_params_struct tps);
void setKey(key_command_t key);
geometry_msgs::Twist computeVelocityCommands();
private:
std::deque<Eigen::Vector2f> latency_command_queue_;
int latency_command_queue_size_;
vel_params_struct velocity_parameters_;
time_params_struct time_parameters_;
navigation_state_t current_state_;
key_command_t key_command_;
tf::TransformListener* tf_;
costmap_2d::Costmap2DROS* costmap_ros_;
costmap_2d::Costmap2D costmap_;
BasicControllerState forward_state_;
StateMachinePlanner.cpp (インスタンス化する場所):
namespace state_machine_planner {
StateMachinePlanner::StateMachinePlanner() : tf_(NULL), costmap_ros_(NULL) {
tf_ = new tf::TransformListener(ros::Duration(10));
costmap_ros_ = new costmap_2d::Costmap2DROS("costmap",*tf_);
costmap_ros_->getCostmapCopy(costmap_);
forward_state_(costmap_ros_);
}
些細なことに思えるかもしれませんが、私を救ってくれる C++ ウィザードを見つけたいと思っていました。この 1 つの問題にあまりにも長い時間を費やしてきました。