Skip to content

Commit

Permalink
Merge pull request #21 from lge-ros2/main
Browse files Browse the repository at this point in the history
Merge 'main' branch into 'foxy'
  • Loading branch information
hyunseok-yang authored Feb 7, 2021
2 parents ce0f4ce + 3ee7433 commit dee48d0
Showing 16 changed files with 57 additions and 55 deletions.
2 changes: 1 addition & 1 deletion cloisim_ros_base/package.xml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>cloisim_ros_base</name>
<version>2.4.5</version>
<version>2.5.0</version>
<description>CLOiSim-ROS base class for other CLOiSim-ROS</description>
<maintainer email="hyunseok7.yang@lge.com">Hyunseok Yang</maintainer>
<author email="hyunseok7.yang@lge.com">Hyunseok Yang</author>
2 changes: 1 addition & 1 deletion cloisim_ros_bridge_zmq/package.xml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>cloisim_ros_bridge_zmq</name>
<version>2.4.5</version>
<version>2.5.0</version>
<description>bridge for cloisim(simulator) connection through ZMQ</description>
<maintainer email="hyunseok7.yang@lge.com">Hyunseok Yang</maintainer>
<author email="hyunseok7.yang@lge.com">Hyunseok Yang</author>
2 changes: 1 addition & 1 deletion cloisim_ros_bringup/package.xml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>cloisim_ros_bringup</name>
<version>2.4.5</version>
<version>2.5.0</version>
<description>Bringup scripts and configurations for cloisim_ros</description>

<maintainer email="hyunseok7.yang@lge.com">Hyunseok Yang</maintainer>
60 changes: 32 additions & 28 deletions cloisim_ros_bringup/src/main.cpp
Original file line number Diff line number Diff line change
@@ -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<BringUpParam>();
@@ -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;
2 changes: 1 addition & 1 deletion cloisim_ros_camera/package.xml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>cloisim_ros_camera</name>
<version>2.4.5</version>
<version>2.5.0</version>
<description>virtual camera for cloisim</description>
<maintainer email="sungkyu.kang@lge.com">Sungkyu Kang</maintainer>
<maintainer email="hyunseok7.yang@lge.com">Hyunseok Yang</maintainer>
2 changes: 1 addition & 1 deletion cloisim_ros_depthcamera/package.xml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>cloisim_ros_depthcamera</name>
<version>2.4.5</version>
<version>2.5.0</version>
<description>virtual depth camera for simulator</description>
<maintainer email="sungkyu.kang@lge.com">Sungkyu Kang</maintainer>
<maintainer email="hyunseok7.yang@lge.com">Hyunseok Yang</maintainer>
Original file line number Diff line number Diff line change
@@ -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,15 +93,15 @@ namespace cloisim_ros
const std::shared_ptr<elevator_system_msgs::srv::ReturnBool::Request> /*request*/,
const std::shared_ptr<elevator_system_msgs::srv::ReturnBool::Response> 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);
}

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);
};
2 changes: 1 addition & 1 deletion cloisim_ros_elevatorsystem/package.xml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>cloisim_ros_elevatorsystem</name>
<version>2.4.5</version>
<version>2.5.0</version>
<description>elevator system for simulation</description>

<maintainer email="sungkyu.kang@lge.com">Sungkyu Kang</maintainer>
20 changes: 10 additions & 10 deletions cloisim_ros_elevatorsystem/src/elevatorsystem.cpp
Original file line number Diff line number Diff line change
@@ -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<srv::GetElevatorInformation::Request> request,
const shared_ptr<srv::GetElevatorInformation::Response> 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<srv::RequestDoor::Request> request,
const shared_ptr<srv::RequestDoor::Response> 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<srv::RequestDoor::Request> request,
const shared_ptr<srv::RequestDoor::Response> 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<srv::RequestDoor::Request> request,
const shared_ptr<srv::RequestDoor::Response> 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;
}
2 changes: 1 addition & 1 deletion cloisim_ros_gps/package.xml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>cloisim_ros_gps</name>
<version>2.4.5</version>
<version>2.5.0</version>
<description>virtual gps for simulation</description>
<maintainer email="hyunseok7.yang@lge.com">Hyunseok Yang</maintainer>
<author email="hyunseok7.yang@lge.com">Hyunseok Yang</author>
2 changes: 1 addition & 1 deletion cloisim_ros_lidar/package.xml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>cloisim_ros_lidar</name>
<version>2.4.5</version>
<version>2.5.0</version>
<description>virtual lidar for simulation</description>
<maintainer email="hyunseok7.yang@lge.com">Hyunseok Yang</maintainer>
<author email="hyunseok7.yang@lge.com">Hyunseok Yang</author>
2 changes: 1 addition & 1 deletion cloisim_ros_micom/package.xml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>cloisim_ros_micom</name>
<version>2.4.5</version>
<version>2.5.0</version>
<description>micom package for simulator</description>
<maintainer email="hyunseok7.yang@lge.com">Hyunseok Yang</maintainer>
<author email="hyunseok7.yang@lge.com">Hyunseok Yang</author>
2 changes: 1 addition & 1 deletion cloisim_ros_multicamera/package.xml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>cloisim_ros_multicamera</name>
<version>2.4.5</version>
<version>2.5.0</version>
<description>virtual multi-camera for simulator</description>
<maintainer email="sungkyu.kang@lge.com">Sungkyu Kang</maintainer>
<maintainer email="hyunseok7.yang@lge.com">Hyunseok Yang</maintainer>
2 changes: 1 addition & 1 deletion cloisim_ros_protobuf_msgs/package.xml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>cloisim_ros_protobuf_msgs</name>
<version>2.4.5</version>
<version>2.5.0</version>
<description>CLOiSim-ROS interafces for communication between simulator and CLOiSim-ROS</description>
<maintainer email="hyunseok7.yang@lge.com">Hyunseok Yang</maintainer>
<author email="hyunseok7.yang@lge.com">Hyunseok Yang</author>
2 changes: 1 addition & 1 deletion cloisim_ros_realsense/package.xml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>cloisim_ros_realsense</name>
<version>2.4.5</version>
<version>2.5.0</version>
<description>virtual realsense for simulator</description>
<maintainer email="sungkyu.kang@lge.com">Sungkyu Kang</maintainer>
<maintainer email="hyunseok7.yang@lge.com">Hyunseok Yang</maintainer>
2 changes: 1 addition & 1 deletion cloisim_ros_world/package.xml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>cloisim_ros_world</name>
<version>2.4.5</version>
<version>2.5.0</version>
<description>Utilities to interface with Unity through ROS.</description>
<maintainer email="hyunseok7.yang@lge.com">Hyunseok Yang</maintainer>
<author email="hyunseok7.yang@lge.com">Hyunseok Yang</author>

0 comments on commit dee48d0

Please sign in to comment.