diff --git a/cloisim_ros_base/package.xml b/cloisim_ros_base/package.xml index 2fa2c2cc..2388e8e9 100644 --- a/cloisim_ros_base/package.xml +++ b/cloisim_ros_base/package.xml @@ -2,7 +2,7 @@ cloisim_ros_base - 2.4.5 + 2.5.0 CLOiSim-ROS base class for other CLOiSim-ROS Hyunseok Yang Hyunseok Yang diff --git a/cloisim_ros_bridge_zmq/package.xml b/cloisim_ros_bridge_zmq/package.xml index c5d1e24b..afb26476 100644 --- a/cloisim_ros_bridge_zmq/package.xml +++ b/cloisim_ros_bridge_zmq/package.xml @@ -2,7 +2,7 @@ cloisim_ros_bridge_zmq - 2.4.5 + 2.5.0 bridge for cloisim(simulator) connection through ZMQ Hyunseok Yang Hyunseok Yang diff --git a/cloisim_ros_bringup/package.xml b/cloisim_ros_bringup/package.xml index 8da53fb4..5a34d512 100644 --- a/cloisim_ros_bringup/package.xml +++ b/cloisim_ros_bringup/package.xml @@ -2,7 +2,7 @@ cloisim_ros_bringup - 2.4.5 + 2.5.0 Bringup scripts and configurations for cloisim_ros Hyunseok Yang diff --git a/cloisim_ros_bringup/src/main.cpp b/cloisim_ros_bringup/src/main.cpp index 31c8c8ea..cc0d77af 100644 --- a/cloisim_ros_bringup/src/main.cpp +++ b/cloisim_ros_bringup/src/main.cpp @@ -27,35 +27,8 @@ using namespace std; -int main(int argc, char** argv) +void bringup_cloisim_ros(const Json::Value result_map) { - const auto env_bridge_ip = getenv("CLOISIM_BRIDGE_IP"); - const auto env_service_port = getenv("CLOISIM_SERVICE_PORT"); - - const auto bridge_ip = string((env_bridge_ip == nullptr)? "127.0.0.1": env_bridge_ip); - const auto service_port = string((env_service_port == nullptr)? "8080":env_service_port); - - Json::Value result_map; - - auto wsService = new cloisim_ros::WebSocketService(bridge_ip, service_port); - - while (true) - { - // wsService->SetTarget("cloi1"); - result_map = wsService->Run(); - - if (result_map.size() > 1) - { - break; - } - - static const int waitseconds = 3; - cout << "Failed to get all target information " << endl; - cout << "Wait " << waitseconds << "sec and retry to get object info.... " << endl; - sleep(waitseconds); - } - - rclcpp::init(argc, argv); rclcpp::executors::MultiThreadedExecutor executor; const auto bringup_param_node = std::make_shared(); @@ -212,6 +185,37 @@ int main(int argc, char** argv) } executor.spin(); +} + +int main(int argc, char** argv) +{ + rclcpp::init(argc, argv); + + const auto env_bridge_ip = getenv("CLOISIM_BRIDGE_IP"); + const auto env_service_port = getenv("CLOISIM_SERVICE_PORT"); + + const auto bridge_ip = string((env_bridge_ip == nullptr)? "127.0.0.1": env_bridge_ip); + const auto service_port = string((env_service_port == nullptr)? "8080":env_service_port); + + auto wsService = new cloisim_ros::WebSocketService(bridge_ip, service_port); + + while (true) + { + // wsService->SetTarget("cloi1"); + const auto result_map = wsService->Run(); + + if (result_map.size() > 1) + { + bringup_cloisim_ros(result_map); + break; + } + + static const int waitseconds = 3; + cout << "Failed to get all target information " << endl; + cout << "Wait " << waitseconds << "sec and retry to get object info.... " << endl; + sleep(waitseconds); + } + rclcpp::shutdown(); return 0; diff --git a/cloisim_ros_camera/package.xml b/cloisim_ros_camera/package.xml index 17510c84..0f3a52ab 100644 --- a/cloisim_ros_camera/package.xml +++ b/cloisim_ros_camera/package.xml @@ -2,7 +2,7 @@ cloisim_ros_camera - 2.4.5 + 2.5.0 virtual camera for cloisim Sungkyu Kang Hyunseok Yang diff --git a/cloisim_ros_depthcamera/package.xml b/cloisim_ros_depthcamera/package.xml index 96ad658a..3fafee76 100644 --- a/cloisim_ros_depthcamera/package.xml +++ b/cloisim_ros_depthcamera/package.xml @@ -2,7 +2,7 @@ cloisim_ros_depthcamera - 2.4.5 + 2.5.0 virtual depth camera for simulator Sungkyu Kang Hyunseok Yang diff --git a/cloisim_ros_elevatorsystem/include/cloisim_ros_elevatorsystem/elevatorsystem.hpp b/cloisim_ros_elevatorsystem/include/cloisim_ros_elevatorsystem/elevatorsystem.hpp index c1f2c119..bd1f4586 100644 --- a/cloisim_ros_elevatorsystem/include/cloisim_ros_elevatorsystem/elevatorsystem.hpp +++ b/cloisim_ros_elevatorsystem/include/cloisim_ros_elevatorsystem/elevatorsystem.hpp @@ -39,8 +39,6 @@ namespace cloisim_ros virtual void UpdateData(const uint bridge_index) override { (void)bridge_index; }; private: - static const int NON_ELEVATOR_INDEX = -1; - std::string systemName_; std::string hashKeySrv_; @@ -95,7 +93,7 @@ namespace cloisim_ros const std::shared_ptr /*request*/, const std::shared_ptr response); - cloisim::msgs::Param CreateRequest(const std::string service_name, const int elevator_index) + cloisim::msgs::Param CreateRequest(const std::string service_name, const std::string elevator_index) { return CreateRequest(service_name, "", "", elevator_index); } @@ -103,7 +101,7 @@ namespace cloisim_ros cloisim::msgs::Param CreateRequest(const std::string service_name, const std::string current_floor, const std::string target_floor, - const int elevator_index = NON_ELEVATOR_INDEX); + const std::string elevator_index = ""); bool GetResultFromResponse(const cloisim::msgs::Param &response_msg, const int children_index = 1); }; diff --git a/cloisim_ros_elevatorsystem/package.xml b/cloisim_ros_elevatorsystem/package.xml index f4218b9c..e276d2f9 100644 --- a/cloisim_ros_elevatorsystem/package.xml +++ b/cloisim_ros_elevatorsystem/package.xml @@ -2,7 +2,7 @@ cloisim_ros_elevatorsystem - 2.4.5 + 2.5.0 elevator system for simulation Sungkyu Kang diff --git a/cloisim_ros_elevatorsystem/src/elevatorsystem.cpp b/cloisim_ros_elevatorsystem/src/elevatorsystem.cpp index 22210d38..c3443fb0 100644 --- a/cloisim_ros_elevatorsystem/src/elevatorsystem.cpp +++ b/cloisim_ros_elevatorsystem/src/elevatorsystem.cpp @@ -166,8 +166,8 @@ void ElevatorSystem::GetElevatorCalled( auto result_param = response_msg.children(2); if (result_param.IsInitialized()) { - const auto elevator_index = (result_param.name().compare("elevator_index") != 0) ? NON_ELEVATOR_INDEX : result_param.value().int_value(); - response->elevator_index = to_string(elevator_index); + const auto elevator_index = (result_param.name().compare("elevator_index") != 0) ? "":result_param.value().string_value(); + response->elevator_index = elevator_index; } } } @@ -178,7 +178,7 @@ void ElevatorSystem::GetElevatorInfo( const shared_ptr request, const shared_ptr response) { - auto message = CreateRequest("get_elevator_information", stoi(request->elevator_index)); + auto message = CreateRequest("get_elevator_information", request->elevator_index); string serializedBuffer; message.SerializeToString(&serializedBuffer); @@ -221,7 +221,7 @@ void ElevatorSystem::SelectFloor( auto message = CreateRequest("select_elevator_floor", request->current_floor, request->target_floor, - stoi(request->elevator_index)); + request->elevator_index); string serializedBuffer; message.SerializeToString(&serializedBuffer); @@ -244,7 +244,7 @@ void ElevatorSystem::RequestDoorOpen( const shared_ptr request, const shared_ptr response) { - auto message = CreateRequest("request_door_open", stoi(request->elevator_index)); + auto message = CreateRequest("request_door_open", request->elevator_index); string serializedBuffer; message.SerializeToString(&serializedBuffer); @@ -268,7 +268,7 @@ void ElevatorSystem::RequestDoorClose( const shared_ptr request, const shared_ptr response) { - auto message = CreateRequest("request_door_close", stoi(request->elevator_index)); + auto message = CreateRequest("request_door_close", request->elevator_index); string serializedBuffer; message.SerializeToString(&serializedBuffer); @@ -292,7 +292,7 @@ void ElevatorSystem::IsDoorOpened( const shared_ptr request, const shared_ptr response) { - auto message = CreateRequest("is_door_opened", stoi(request->elevator_index)); + auto message = CreateRequest("is_door_opened", request->elevator_index); string serializedBuffer; message.SerializeToString(&serializedBuffer); @@ -341,7 +341,7 @@ msgs::Param ElevatorSystem::CreateRequest( const string service_name, const string current_floor, const string target_floor, - const int elevator_index) + const string elevator_index) { msgs::Param newMessage; newMessage.set_name(systemName_); @@ -370,8 +370,8 @@ msgs::Param ElevatorSystem::CreateRequest( pParam = newMessage.add_children(); pParam->set_name("elevator_index"); pVal = pParam->mutable_value(); - pVal->set_type(msgs::Any::INT32); - pVal->set_int_value(elevator_index); + pVal->set_type(msgs::Any::STRING); + pVal->set_string_value(elevator_index); return newMessage; } diff --git a/cloisim_ros_gps/package.xml b/cloisim_ros_gps/package.xml index 0e4b2f13..60b3e84c 100644 --- a/cloisim_ros_gps/package.xml +++ b/cloisim_ros_gps/package.xml @@ -2,7 +2,7 @@ cloisim_ros_gps - 2.4.5 + 2.5.0 virtual gps for simulation Hyunseok Yang Hyunseok Yang diff --git a/cloisim_ros_lidar/package.xml b/cloisim_ros_lidar/package.xml index eb4ca66a..8fa3dd2e 100644 --- a/cloisim_ros_lidar/package.xml +++ b/cloisim_ros_lidar/package.xml @@ -2,7 +2,7 @@ cloisim_ros_lidar - 2.4.5 + 2.5.0 virtual lidar for simulation Hyunseok Yang Hyunseok Yang diff --git a/cloisim_ros_micom/package.xml b/cloisim_ros_micom/package.xml index b92edb8b..97f6c47f 100644 --- a/cloisim_ros_micom/package.xml +++ b/cloisim_ros_micom/package.xml @@ -2,7 +2,7 @@ cloisim_ros_micom - 2.4.5 + 2.5.0 micom package for simulator Hyunseok Yang Hyunseok Yang diff --git a/cloisim_ros_multicamera/package.xml b/cloisim_ros_multicamera/package.xml index ae9d240e..2d428ea3 100644 --- a/cloisim_ros_multicamera/package.xml +++ b/cloisim_ros_multicamera/package.xml @@ -2,7 +2,7 @@ cloisim_ros_multicamera - 2.4.5 + 2.5.0 virtual multi-camera for simulator Sungkyu Kang Hyunseok Yang diff --git a/cloisim_ros_protobuf_msgs/package.xml b/cloisim_ros_protobuf_msgs/package.xml index 92061368..29334373 100644 --- a/cloisim_ros_protobuf_msgs/package.xml +++ b/cloisim_ros_protobuf_msgs/package.xml @@ -2,7 +2,7 @@ cloisim_ros_protobuf_msgs - 2.4.5 + 2.5.0 CLOiSim-ROS interafces for communication between simulator and CLOiSim-ROS Hyunseok Yang Hyunseok Yang diff --git a/cloisim_ros_realsense/package.xml b/cloisim_ros_realsense/package.xml index 373230b4..a9a2e70e 100644 --- a/cloisim_ros_realsense/package.xml +++ b/cloisim_ros_realsense/package.xml @@ -2,7 +2,7 @@ cloisim_ros_realsense - 2.4.5 + 2.5.0 virtual realsense for simulator Sungkyu Kang Hyunseok Yang diff --git a/cloisim_ros_world/package.xml b/cloisim_ros_world/package.xml index 9db4af41..a61ff8e7 100644 --- a/cloisim_ros_world/package.xml +++ b/cloisim_ros_world/package.xml @@ -2,7 +2,7 @@ cloisim_ros_world - 2.4.5 + 2.5.0 Utilities to interface with Unity through ROS. Hyunseok Yang Hyunseok Yang