diff --git a/ROSCommonObjects/.gitignore b/ROSCommonObjects/.gitignore deleted file mode 100644 index 3a64ab52a..000000000 --- a/ROSCommonObjects/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -src-gen/ -components/ -*.rossystem -!robotino.rossystem diff --git a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/.project b/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/.project deleted file mode 100644 index 77d16852c..000000000 --- a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/.project +++ /dev/null @@ -1,19 +0,0 @@ - - - de.fraunhofer.ipa.ros.communication.objects - - - CommBasicObjects - de.fraunhofer.ipa.ros - - - - org.eclipse.xtext.ui.shared.xtextBuilder - - - - - - org.eclipse.xtext.ui.shared.xtextNature - - diff --git a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/BasicSpecs/Joy.ros b/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/BasicSpecs/Joy.ros deleted file mode 100644 index 7b6539de1..000000000 --- a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/BasicSpecs/Joy.ros +++ /dev/null @@ -1,8 +0,0 @@ -PackageSet { package { - CatkinPackage joy { artifact { - Artifact joy_node { node Node { name joy_node - publisher { - Publisher { name "joy" message "sensor_msgs.Joy" }, - Publisher { name "diagnostics" message "diagnostic_msgs.DiagnosticArray" } - }} -}}}}} \ No newline at end of file diff --git a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/BasicSpecs/Laser2DScan.ros b/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/BasicSpecs/Laser2DScan.ros deleted file mode 100644 index d62e66072..000000000 --- a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/BasicSpecs/Laser2DScan.ros +++ /dev/null @@ -1,9 +0,0 @@ -PackageSet { package { - CatkinPackage scan_2d { artifact { - Artifact scan_2d { node Node { name scan_2d - publisher { - Publisher { name scan message "sensor_msgs.LaserScan" } , - Publisher { name diagnostics message "diagnostic_msgs.DiagnosticArray" - }}}} - -}}}} \ No newline at end of file diff --git a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/BasicSpecs/Teleop.ros b/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/BasicSpecs/Teleop.ros deleted file mode 100644 index 05e0ba8e5..000000000 --- a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/BasicSpecs/Teleop.ros +++ /dev/null @@ -1,8 +0,0 @@ -PackageSet { package { - CatkinPackage teleop { artifact { - Artifact joystick_teleop_node { - node Node { name joystick_teleop_node - publisher { Publisher { name cmd_vel message "geometry_msgs.Twist" } } - subscriber { Subscriber { name joy message "sensor_msgs.Joy" } } - } - }}}}} \ No newline at end of file diff --git a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/common_msgs.ros b/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/common_msgs.ros deleted file mode 100644 index fa271834a..000000000 --- a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/common_msgs.ros +++ /dev/null @@ -1,120 +0,0 @@ -PackageSet{package{ - Package geometry_msgs{ spec { - TopicSpec Accel{ message { Vector3 linear Vector3 angular }}, - TopicSpec AccelStamped{ message { Header header Accel accel }}, - TopicSpec AccelWithCovariance{ message { Accel accel float64[] covariance }}, - TopicSpec AccelWithCovarianceStamped{ message { Header header AccelWithCovariance accel }}, - TopicSpec Inertia{ message { float64 m "geometry_msgs.Vector3" com float64 ixx float64 ixy float64 ixz float64 iyy float64 iyz float64 izz }}, - TopicSpec InertiaStamped{ message { Header header Inertia inertia }}, - TopicSpec Point{ message { float64 x float64 y float64 z }}, - TopicSpec Point32{ message { float32 x float32 y float32 z }}, - TopicSpec PointStamped{ message { Header header Point point }}, - TopicSpec Polygon{ message { Point32[] points }}, - TopicSpec PolygonStamped{ message { Header header Polygon polygon }}, - TopicSpec Pose{ message { Point position Quaternion orientation }}, - TopicSpec Pose2D{ message { float64 x float64 y float64 theta }}, - TopicSpec PoseArray{ message { Header header Pose[] poses }}, - TopicSpec PoseStamped{ message { Header header Pose pose }}, - TopicSpec PoseWithCovariance{ message { Pose pose float64[] covariance }}, - TopicSpec PoseWithCovarianceStamped{ message { Header header PoseWithCovariance pose }}, - TopicSpec Quaternion{ message { float64 x float64 y float64 z float64 w }}, - TopicSpec QuaternionStamped{ message { Header header Quaternion quaternion }}, - TopicSpec Transform{ message { Vector3 translation Quaternion rotation }}, - TopicSpec TransformStamped{ message { Header header string child_frame_id Transform transform }}, - TopicSpec Twist{ message { Vector3 linear Vector3 angular }}, - TopicSpec TwistStamped{ message { Header header Twist twist }}, - TopicSpec TwistWithCovariance{ message { Twist twist float64[] covariance }}, - TopicSpec TwistWithCovarianceStamped{ message { Header header TwistWithCovariance twist }}, - TopicSpec Vector3{ message { float64 x float64 y float64 z }}, - TopicSpec Vector3Stamped{ message { Header header Vector3 vector }}, - TopicSpec Wrench{ message { Vector3 force Vector3 torque }}, - TopicSpec WrenchStamped{ message { Header header Wrench wrench }} - }}, - Package actionlib_msgs{ spec { - TopicSpec GoalID{ message { time stamp string id }}, - TopicSpec GoalStatus{ message { GoalID goal_id uint8 status uint8 PENDING=0 uint8 ACTIVE=1 uint8 PREEMPTED=2 uint8 SUCCEEDED=3 uint8 ABORTED=4 uint8 REJECTED=5 uint8 PREEMPTING=6 uint8 RECALLING=7 uint8 RECALLED=8 uint8 LOST=9 string text }}, - TopicSpec GoalStatusArray{ message { Header header GoalStatus[] status_list }} - }}, - Package diagnostic_msgs{ spec { - TopicSpec DiagnosticArray{ message { Header header DiagnosticStatus[] status }}, - TopicSpec DiagnosticStatus{ message { byte OK=0 byte WARN=1 byte ERROR=2 byte STALE=3 byte level string name string message string hardware_id KeyValue[] values }}, - TopicSpec KeyValue{ message { string key string value }}, - ServiceSpec AddDiagnostics{ request { string load_namespace } response { bool success string message } }, - ServiceSpec SelfTest{ request { } response { string id byte passed DiagnosticStatus[] status } } - }}, - Package nav_msgs{ spec { - TopicSpec GetMapAction{ message { GetMapActionGoal action_goal GetMapActionResult action_result GetMapActionFeedback action_feedback }}, - TopicSpec GetMapActionFeedback{ message { Header header "actionlib_msgs.GoalStatus" status GetMapFeedback feedback }}, - TopicSpec GetMapActionGoal{ message { Header header "actionlib_msgs.GoalID" goal_id GetMapGoal goal }}, - TopicSpec GetMapActionResult{ message { Header header "actionlib_msgs.GoalStatus" status GetMapResult result }}, - TopicSpec GetMapFeedback{ message { }}, - TopicSpec GetMapGoal{ message { }}, - TopicSpec GetMapResult{ message { "nav_msgs.OccupancyGrid" map }}, - TopicSpec GridCells{ message { Header header float32 cell_width float32 cell_height "geometry_msgs.Point"[] cells }}, - TopicSpec MapMetaData{ message { time map_load_time float32 resolution uint32 width uint32 height "geometry_msgs.Pose" origin }}, - TopicSpec OccupancyGrid{ message { Header header MapMetaData info int8[] data }}, - TopicSpec Odometry{ message { Header header string child_frame_id "geometry_msgs.PoseWithCovariance" pose "geometry_msgs.TwistWithCovariance" twist }}, - TopicSpec Path{ message { Header header "geometry_msgs.PoseStamped"[] poses }}, - ServiceSpec GetMap{ request { } response { "nav_msgs.OccupancyGrid" map } }, - ServiceSpec GetPlan{ request { "geometry_msgs.PoseStamped" start "geometry_msgs.PoseStamped" goal float32 tolerance } response { "nav_msgs.Path" plan } }, - ServiceSpec SetMap{ request { "nav_msgs.OccupancyGrid" map "geometry_msgs.PoseWithCovarianceStamped" initial_pose } response { bool success } } - }}, - Package sensor_msgs{ spec { - TopicSpec BatteryState{ message { uint8 POWER_SUPPLY_STATUS_UNKNOWN=0 uint8 POWER_SUPPLY_STATUS_CHARGING=1 uint8 POWER_SUPPLY_STATUS_DISCHARGING=2 uint8 POWER_SUPPLY_STATUS_NOT_CHARGING=3 uint8 POWER_SUPPLY_STATUS_FULL=4 uint8 POWER_SUPPLY_HEALTH_UNKNOWN=0 uint8 POWER_SUPPLY_HEALTH_GOOD=1 uint8 POWER_SUPPLY_HEALTH_OVERHEAT=2 uint8 POWER_SUPPLY_HEALTH_DEAD=3 uint8 POWER_SUPPLY_HEALTH_OVERVOLTAGE=4 uint8 POWER_SUPPLY_HEALTH_UNSPEC_FAILURE=5 uint8 POWER_SUPPLY_HEALTH_COLD=6 uint8 POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE=7 uint8 POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE=8 uint8 POWER_SUPPLY_TECHNOLOGY_UNKNOWN=0 uint8 POWER_SUPPLY_TECHNOLOGY_NIMH=1 uint8 POWER_SUPPLY_TECHNOLOGY_LION=2 uint8 POWER_SUPPLY_TECHNOLOGY_LIPO=3 uint8 POWER_SUPPLY_TECHNOLOGY_LIFE=4 uint8 POWER_SUPPLY_TECHNOLOGY_NICD=5 uint8 POWER_SUPPLY_TECHNOLOGY_LIMN=6 Header header float32 voltage float32 current float32 charge float32 capacity float32 design_capacity float32 percentage uint8 power_supply_status uint8 power_supply_health uint8 power_supply_technology bool present float32[] cell_voltage string location string serial_number }}, - TopicSpec CameraInfo{ message { Header header uint32 height uint32 width string distortion_model float64[] D float64[] K float64[] R float64[] P uint32 binning_x uint32 binning_y RegionOfInterest roi }}, - TopicSpec ChannelFloat32{ message { string name float32[] values }}, - TopicSpec CompressedImage{ message { Header header string format uint8[] data }}, - TopicSpec FluidPressure{ message { Header header float64 fluid_pressure float64 variance }}, - TopicSpec Illuminance{ message { Header header float64 illuminance float64 variance }}, - TopicSpec Image{ message { Header header uint32 height uint32 width string encoding uint8 is_bigendian uint32 step uint8[] data }}, - TopicSpec Imu{ message { Header header "geometry_msgs.Quaternion" orientation float64[] orientation_covariance "geometry_msgs.Vector3" angular_velocity float64[] angular_velocity_covariance "geometry_msgs.Vector3" linear_acceleration float64[] linear_acceleration_covariance }}, - TopicSpec JointState{ message { Header header string[] name float64[] position float64[] velocity float64[] effort }}, - TopicSpec Joy{ message { Header header float32[] axes int32[] buttons }}, - TopicSpec JoyFeedback{ message { uint8 TYPE_LED=0 uint8 TYPE_RUMBLE=1 uint8 TYPE_BUZZER=2 uint8 type uint8 id float32 intensity }}, - TopicSpec JoyFeedbackArray{ message { JoyFeedback[] array }}, - TopicSpec LaserEcho{ message { float32[] echoes }}, - TopicSpec LaserScan{ message { Header header float32 angle_min float32 angle_max float32 angle_increment float32 time_increment float32 scan_time float32 range_min float32 range_max float32[] ranges float32[] intensities }}, - TopicSpec MagneticField{ message { Header header "geometry_msgs.Vector3" magnetic_field float64[] magnetic_field_covariance }}, - TopicSpec MultiDOFJointState{ message { Header header string[] joint_names "geometry_msgs.Transform"[] transforms "geometry_msgs.Twist"[] twist "geometry_msgs.Wrench"[] wrench }}, - TopicSpec MultiEchoLaserScan{ message { Header header float32 angle_min float32 angle_max float32 angle_increment float32 time_increment float32 scan_time float32 range_min float32 range_max LaserEcho[] ranges LaserEcho[] intensities }}, - TopicSpec NavSatFix{ message { Header header NavSatStatus status float64 latitude float64 longitude float64 altitude float64[] position_covariance uint8 COVARIANCE_TYPE_UNKNOWN=0 uint8 COVARIANCE_TYPE_APPROXIMATED=1 uint8 COVARIANCE_TYPE_DIAGONAL_KNOWN=2 uint8 COVARIANCE_TYPE_KNOWN=3 uint8 position_covariance_type }}, - TopicSpec NavSatStatus{ message { int8 STATUS_NO_FIX=-1 int8 STATUS_FIX=0 int8 STATUS_SBAS_FIX=1 int8 STATUS_GBAS_FIX=2 int8 status uint16 SERVICE_GPS=1 uint16 SERVICE_GLONASS=2 uint16 SERVICE_COMPASS=4 uint16 SERVICE_GALILEO=8 uint16 service }}, - TopicSpec PointCloud{ message { Header header "geometry_msgs.Point32"[] points ChannelFloat32[] channels }}, - TopicSpec PointCloud2{ message { Header header uint32 height uint32 width PointField[] fields bool is_bigendian uint32 point_step uint32 row_step uint8[] data bool is_dense }}, - TopicSpec PointField{ message { uint8 INT8=1 uint8 UINT8=2 uint8 INT16=3 uint8 UINT16=4 uint8 INT32=5 uint8 UINT32=6 uint8 FLOAT32=7 uint8 FLOAT64=8 string name uint32 offset uint8 datatype uint32 count }}, - TopicSpec Range{ message { Header header uint8 ULTRASOUND=0 uint8 INFRARED=1 uint8 radiation_type float32 field_of_view float32 min_range float32 max_range float32 range }}, - TopicSpec RegionOfInterest{ message { uint32 x_offset uint32 y_offset uint32 height uint32 width bool do_rectify }}, - TopicSpec RelativeHumidity{ message { Header header float64 relative_humidity float64 variance }}, - TopicSpec Temperature{ message { Header header float64 temperature float64 variance }}, - TopicSpec TimeReference{ message { Header header time time_ref string source }}, - ServiceSpec SetCameraInfo{ request { "sensor_msgs.CameraInfo" camera_info } response { bool success string status_message } } - }}, - Package shape_msgs{ spec { - TopicSpec Mesh{ message { MeshTriangle[] triangles "geometry_msgs.Point"[] vertices }}, - TopicSpec MeshTriangle{ message { uint32[] vertex_indices }}, - TopicSpec Plane{ message { float64[] coef }}, - TopicSpec SolidPrimitive{ message { uint8 BOX=1 uint8 SPHERE=2 uint8 CYLINDER=3 uint8 CONE=4 uint8 type float64[] dimensions uint8 BOX_X=0 uint8 BOX_Y=1 uint8 BOX_Z=2 uint8 SPHERE_RADIUS=0 uint8 CYLINDER_HEIGHT=0 uint8 CYLINDER_RADIUS=1 uint8 CONE_HEIGHT=0 uint8 CONE_RADIUS=1 }} - }}, - Package stereo_msgs{ spec { - TopicSpec DisparityImage{ message { Header header "sensor_msgs.Image" image float32 f float32 T "sensor_msgs.RegionOfInterest" valid_window float32 min_disparity float32 max_disparity float32 delta_d }} - }}, - Package trajectory_msgs{ spec { - TopicSpec JointTrajectory{ message { Header header string[] joint_names JointTrajectoryPoint[] points }}, - TopicSpec JointTrajectoryPoint{ message { float64[] positions float64[] velocities float64[] accelerations float64[] effort duration time_from_start }}, - TopicSpec MultiDOFJointTrajectory{ message { Header header string[] joint_names MultiDOFJointTrajectoryPoint[] points }}, - TopicSpec MultiDOFJointTrajectoryPoint{ message { "geometry_msgs.Transform"[] transforms "geometry_msgs.Twist"[] velocities "geometry_msgs.Twist"[] accelerations duration time_from_start }} - }}, - Package visualization_msgs{ spec { - TopicSpec ImageMarker{ message { uint8 CIRCLE=0 uint8 LINE_STRIP=1 uint8 LINE_LIST=2 uint8 POLYGON=3 uint8 POINTS=4 uint8 ADD=0 uint8 REMOVE=1 Header header string ns int32 id int32 type int32 action "geometry_msgs.Point" position float32 scale "std_msgs.ColorRGBA" outline_color uint8 filled "std_msgs.ColorRGBA" fill_color duration lifetime "geometry_msgs.Point"[] points "std_msgs.ColorRGBA"[] outline_colors }}, - TopicSpec InteractiveMarker{ message { Header header "geometry_msgs.Pose" pose string name string description float32 scale MenuEntry[] menu_entries InteractiveMarkerControl[] controls }}, - TopicSpec InteractiveMarkerControl{ message { string name "geometry_msgs.Quaternion" orientation uint8 INHERIT=0 uint8 FIXED=1 uint8 VIEW_FACING=2 uint8 orientation_mode uint8 NONE=0 uint8 MENU=1 uint8 BUTTON=2 uint8 MOVE_AXIS=3 uint8 MOVE_PLANE=4 uint8 ROTATE_AXIS=5 uint8 MOVE_ROTATE=6 uint8 MOVE_3D=7 uint8 ROTATE_3D=8 uint8 MOVE_ROTATE_3D=9 uint8 interaction_mode bool always_visible Marker[] markers bool independent_marker_orientation string description }}, - TopicSpec InteractiveMarkerFeedback{ message { Header header string client_id string marker_name string control_name uint8 KEEP_ALIVE=0 uint8 POSE_UPDATE=1 uint8 MENU_SELECT=2 uint8 BUTTON_CLICK=3 uint8 MOUSE_DOWN=4 uint8 MOUSE_UP=5 uint8 event_type "geometry_msgs.Pose" pose uint32 menu_entry_id "geometry_msgs.Point" mouse_point bool mouse_point_valid }}, - TopicSpec InteractiveMarkerInit{ message { string server_id uint64 seq_num InteractiveMarker[] markers }}, - TopicSpec InteractiveMarkerPose{ message { Header header "geometry_msgs.Pose" pose string name }}, - TopicSpec InteractiveMarkerUpdate{ message { string server_id uint64 seq_num uint8 KEEP_ALIVE=0 uint8 UPDATE=1 uint8 type InteractiveMarker[] markers InteractiveMarkerPose[] poses string[] erases }}, - TopicSpec Marker{ message { uint8 ARROW=0 uint8 CUBE=1 uint8 SPHERE=2 uint8 CYLINDER=3 uint8 LINE_STRIP=4 uint8 LINE_LIST=5 uint8 CUBE_LIST=6 uint8 SPHERE_LIST=7 uint8 POINTS=8 uint8 TEXT_VIEW_FACING=9 uint8 MESH_RESOURCE=10 uint8 TRIANGLE_LIST=11 uint8 ADD=0 uint8 MODIFY=0 uint8 DELETE=2 uint8 DELETEALL=3 Header header string ns int32 id int32 type int32 action "geometry_msgs.Pose" pose "geometry_msgs.Vector3" scale "std_msgs.ColorRGBA" color duration lifetime bool frame_locked "geometry_msgs.Point"[] points "std_msgs.ColorRGBA"[] colors string text string mesh_resource bool mesh_use_embedded_materials }}, - TopicSpec MarkerArray{ message { Marker[] markers }}, - TopicSpec MenuEntry{ message { uint32 id uint32 parent_id string title string command uint8 FEEDBACK=0 uint8 ROSRUN=1 uint8 ROSLAUNCH=2 uint8 command_type }} - }} - } -} \ No newline at end of file diff --git a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/control_msgs.ros b/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/control_msgs.ros deleted file mode 100644 index 65c58dc2c..000000000 --- a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/control_msgs.ros +++ /dev/null @@ -1,48 +0,0 @@ -PackageSet{package{ - Package control_msgs{ spec { - TopicSpec FollowJointTrajectoryAction{ message { FollowJointTrajectoryActionGoal action_goal FollowJointTrajectoryActionResult action_result FollowJointTrajectoryActionFeedback action_feedback }}, - TopicSpec FollowJointTrajectoryActionFeedback{ message { Header header "actionlib_msgs.GoalStatus" status FollowJointTrajectoryFeedback feedback }}, - TopicSpec FollowJointTrajectoryActionGoal{ message { Header header "actionlib_msgs.GoalID" goal_id FollowJointTrajectoryGoal goal }}, - TopicSpec FollowJointTrajectoryActionResult{ message { Header header "actionlib_msgs.GoalStatus" status FollowJointTrajectoryResult result }}, - TopicSpec FollowJointTrajectoryFeedback{ message { Header header string[] joint_names "trajectory_msgs.JointTrajectoryPoint" desired "trajectory_msgs.JointTrajectoryPoint" actual "trajectory_msgs.JointTrajectoryPoint" error }}, - TopicSpec FollowJointTrajectoryGoal{ message { "trajectory_msgs.JointTrajectory" trajectory JointTolerance[] path_tolerance JointTolerance[] goal_tolerance duration goal_time_tolerance }}, - TopicSpec FollowJointTrajectoryResult{ message { int32 error_code int32 SUCCESSFUL=0 int32 INVALID_GOAL=-1 int32 INVALID_JOINTS=-2 int32 OLD_HEADER_TIMESTAMP=-3 int32 PATH_TOLERANCE_VIOLATED=-4 int32 GOAL_TOLERANCE_VIOLATED=-5 string error_string }}, - TopicSpec GripperCommand{ message { float64 position float64 max_effort }}, - TopicSpec GripperCommandAction{ message { GripperCommandActionGoal action_goal GripperCommandActionResult action_result GripperCommandActionFeedback action_feedback }}, - TopicSpec GripperCommandActionFeedback{ message { Header header "actionlib_msgs.GoalStatus" status GripperCommandFeedback feedback }}, - TopicSpec GripperCommandActionGoal{ message { Header header "actionlib_msgs.GoalID" goal_id GripperCommandGoal goal }}, - TopicSpec GripperCommandActionResult{ message { Header header "actionlib_msgs.GoalStatus" status GripperCommandResult result }}, - TopicSpec GripperCommandFeedback{ message { float64 position float64 effort bool stalled bool reached_goal }}, - TopicSpec GripperCommandGoal{ message { GripperCommand command }}, - TopicSpec GripperCommandResult{ message { float64 position float64 effort bool stalled bool reached_goal }}, - TopicSpec JointControllerState{ message { Header header float64 set_point float64 process_value float64 process_value_dot float64 error float64 time_step float64 command float64 p float64 i float64 d float64 i_clamp bool antiwindup }}, - TopicSpec JointJog{ message { Header header string[] joint_names float64[] displacements float64[] velocities float64 duration }}, - TopicSpec JointTolerance{ message { string name float64 position float64 velocity float64 acceleration }}, - TopicSpec JointTrajectoryAction{ message { JointTrajectoryActionGoal action_goal JointTrajectoryActionResult action_result JointTrajectoryActionFeedback action_feedback }}, - TopicSpec JointTrajectoryActionFeedback{ message { Header header "actionlib_msgs.GoalStatus" status JointTrajectoryFeedback feedback }}, - TopicSpec JointTrajectoryActionGoal{ message { Header header "actionlib_msgs.GoalID" goal_id JointTrajectoryGoal goal }}, - TopicSpec JointTrajectoryActionResult{ message { Header header "actionlib_msgs.GoalStatus" status JointTrajectoryResult result }}, - TopicSpec JointTrajectoryControllerState{ message { Header header string[] joint_names "trajectory_msgs.JointTrajectoryPoint" desired "trajectory_msgs.JointTrajectoryPoint" actual "trajectory_msgs.JointTrajectoryPoint" error }}, - TopicSpec JointTrajectoryFeedback{ message { }}, - TopicSpec JointTrajectoryGoal{ message { "trajectory_msgs.JointTrajectory" trajectory }}, - TopicSpec JointTrajectoryResult{ message { }}, - TopicSpec PidState{ message { Header header duration timestep float64 error float64 error_dot float64 p_error float64 i_error float64 d_error float64 p_term float64 i_term float64 d_term float64 i_max float64 i_min float64 output }}, - TopicSpec PointHeadAction{ message { PointHeadActionGoal action_goal PointHeadActionResult action_result PointHeadActionFeedback action_feedback }}, - TopicSpec PointHeadActionFeedback{ message { Header header "actionlib_msgs.GoalStatus" status PointHeadFeedback feedback }}, - TopicSpec PointHeadActionGoal{ message { Header header "actionlib_msgs.GoalID" goal_id PointHeadGoal goal }}, - TopicSpec PointHeadActionResult{ message { Header header "actionlib_msgs.GoalStatus" status PointHeadResult result }}, - TopicSpec PointHeadFeedback{ message { float64 pointing_angle_error }}, - TopicSpec PointHeadGoal{ message { "geometry_msgs.PointStamped" target "geometry_msgs.Vector3" pointing_axis string pointing_frame duration min_duration float64 max_velocity }}, - TopicSpec PointHeadResult{ message { }}, - TopicSpec SingleJointPositionAction{ message { SingleJointPositionActionGoal action_goal SingleJointPositionActionResult action_result SingleJointPositionActionFeedback action_feedback }}, - TopicSpec SingleJointPositionActionFeedback{ message { Header header "actionlib_msgs.GoalStatus" status SingleJointPositionFeedback feedback }}, - TopicSpec SingleJointPositionActionGoal{ message { Header header "actionlib_msgs.GoalID" goal_id SingleJointPositionGoal goal }}, - TopicSpec SingleJointPositionActionResult{ message { Header header "actionlib_msgs.GoalStatus" status SingleJointPositionResult result }}, - TopicSpec SingleJointPositionFeedback{ message { Header header float64 position float64 velocity float64 error }}, - TopicSpec SingleJointPositionGoal{ message { float64 position duration min_duration float64 max_velocity }}, - TopicSpec SingleJointPositionResult{ message { }}, - ServiceSpec QueryCalibrationState{ request { } response { bool is_calibrated } }, - ServiceSpec QueryTrajectoryState{ request { time time } response { string[] name float64[] position float64[] velocity float64[] acceleration } } - }} - } -} \ No newline at end of file diff --git a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/controller_manager_msgs.ros b/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/controller_manager_msgs.ros deleted file mode 100644 index b66564ac4..000000000 --- a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/controller_manager_msgs.ros +++ /dev/null @@ -1,15 +0,0 @@ -PackageSet{package{ - Package controller_manager_msgs{spec{ - TopicSpec ControllerState{}, - TopicSpec ControllerStatistics{}, - TopicSpec ControllersStatistics{}, - TopicSpec HardwareInterfaceResources{}, - ServiceSpec ListControllerTypes{}, - ServiceSpec ListControllers{}, - ServiceSpec LoadController{}, - ServiceSpec ReloadControllerLibraries{}, - ServiceSpec SwitchController{}, - ServiceSpec UnloadController{} - }} - } -} diff --git a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/dynamic_reconfigure.ros b/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/dynamic_reconfigure.ros deleted file mode 100644 index 929890e55..000000000 --- a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/dynamic_reconfigure.ros +++ /dev/null @@ -1,16 +0,0 @@ -PackageSet{package{ - Package dynamic_reconfigure{spec{ - TopicSpec BoolParameter{}, - TopicSpec Config{}, - TopicSpec ConfigDescription{}, - TopicSpec DoubleParameter{}, - TopicSpec Group{}, - TopicSpec GroupState{}, - TopicSpec IntParameter{}, - TopicSpec ParamDescription{}, - TopicSpec SensorLevels{}, - TopicSpec StrParameter{}, - ServiceSpec Reconfigure{} - }} - } -} diff --git a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/generate_messages_model_helper.sh b/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/generate_messages_model_helper.sh deleted file mode 100755 index 92942aa00..000000000 --- a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/generate_messages_model_helper.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -package_list=$@ - -echo 'PackageSet{package{' -arr_pkg=($package_list) -cout_pkg=${#arr_pkg[@]} - -for p in $package_list -do - cout_pkg=$((cout_pkg-1)) - messages_fullname=$(rosmsg list | grep $p) - arr_msg=($messages_fullname) - cout_msg=${#arr_msg[@]} - services_fullname=$(rossrv list | grep $p) - arr_srv=($services_fullname) - cout_srv=${#arr_srv[@]} - - echo ' Package '$p'{spec{' - - for i in $messages_fullname - do - cout_msg=$((cout_msg-1)) - message=${i/$p\//} - echo -n ' TopicSpec '$message'{}' - if (("$cout_msg" >= "1" || "$cout_srv" >= "1" )) - then - echo ',' - fi - done - - for i in $services_fullname - do - cout_srv=$((cout_srv-1)) - service=${i/$p\//} - echo -n ' ServiceSpec '$service'{}' - if (("$cout_srv" >= "1")) - then - echo ',' - fi - done - echo -n $'\n }}' - if (("$cout_pkg" >= "1")) - then - echo ',' - fi -done - -echo $'\n }' -echo '}' diff --git a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/map_msgs.ros b/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/map_msgs.ros deleted file mode 100644 index 3adda0544..000000000 --- a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/map_msgs.ros +++ /dev/null @@ -1,19 +0,0 @@ -PackageSet{package{ - Package map_msgs{spec{ - TopicSpec OccupancyGridUpdate{}, - TopicSpec PointCloud2Update{}, - TopicSpec ProjectedMap{}, - TopicSpec ProjectedMapInfo{}, - TopicSpec octoOctomap{}, - TopicSpec octoOctomapWithPose{}, - ServiceSpec GetMapROI{}, - ServiceSpec GetPointMap{}, - ServiceSpec GetPointMapROI{}, - ServiceSpec ProjectedMapsInfo{}, - ServiceSpec SaveMap{}, - ServiceSpec SetMapProjections{}, - ServiceSpec octoBoundingBoxQuery{}, - ServiceSpec octoGetOctomap{} - }} - } -} diff --git a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/move_base_msgs.ros b/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/move_base_msgs.ros deleted file mode 100644 index b3aa2f554..000000000 --- a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/move_base_msgs.ros +++ /dev/null @@ -1,13 +0,0 @@ -PackageSet{package{ - Package move_base_msgs{spec{ - TopicSpec MoveBaseAction{}, - TopicSpec MoveBaseActionFeedback{}, - TopicSpec MoveBaseActionGoal{}, - TopicSpec MoveBaseActionResult{}, - TopicSpec MoveBaseFeedback{}, - TopicSpec MoveBaseGoal{}, - TopicSpec MoveBaseResult{}, - ActionSpec MoveBase{} - }} - } -} diff --git a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/nodelet.ros b/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/nodelet.ros deleted file mode 100644 index dc0de0beb..000000000 --- a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/nodelet.ros +++ /dev/null @@ -1,8 +0,0 @@ -PackageSet{package{ - Package nodelet{spec{ - ServiceSpec NodeletList{}, - ServiceSpec NodeletLoad{}, - ServiceSpec NodeletUnload{} - }} - } -} diff --git a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/ros_core.ros b/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/ros_core.ros deleted file mode 100644 index ab606ec35..000000000 --- a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/ros_core.ros +++ /dev/null @@ -1,41 +0,0 @@ -PackageSet{package{ - Package std_msgs{ spec { - TopicSpec Bool{ message { bool data }}, - TopicSpec Byte{ message { byte data }}, - TopicSpec ByteMultiArray{ message { MultiArrayLayout layout byte[] data }}, - TopicSpec ColorRGBA{ message { float32 r float32 g float32 b float32 a }}, - TopicSpec Duration{ message { duration data }}, - TopicSpec Empty{ message { }}, - TopicSpec Float32{ message { float32 data }}, - TopicSpec Float32MultiArray{ message { MultiArrayLayout layout float32[] data }}, - TopicSpec Float64{ message { float64 data }}, - TopicSpec Float64MultiArray{ message { MultiArrayLayout layout float64[] data }}, - TopicSpec Header{ message { uint32 seq time stamp string frame_id }}, - TopicSpec Int16{ message { int16 data }}, - TopicSpec Int16MultiArray{ message { MultiArrayLayout layout int16[] data }}, - TopicSpec Int32{ message { int32 data }}, - TopicSpec Int32MultiArray{ message { MultiArrayLayout layout int32[] data }}, - TopicSpec Int64{ message { int64 data }}, - TopicSpec Int64MultiArray{ message { MultiArrayLayout layout int64[] data }}, - TopicSpec Int8{ message { int8 data }}, - TopicSpec Int8MultiArray{ message { MultiArrayLayout layout int8[] data }}, - TopicSpec MultiArrayDimension{ message { string label uint32 size uint32 stride }}, - TopicSpec MultiArrayLayout{ message { MultiArrayDimension[] dim uint32 data_offset }}, - TopicSpec String{ message { string data }}, - TopicSpec Time{ message { time data }}, - TopicSpec UInt16{ message { uint16 data }}, - TopicSpec UInt16MultiArray{ message { MultiArrayLayout layout uint16[] data }}, - TopicSpec UInt32{ message { uint32 data }}, - TopicSpec UInt32MultiArray{ message { MultiArrayLayout layout uint32[] data }}, - TopicSpec UInt64{ message { uint64 data }}, - TopicSpec UInt64MultiArray{ message { MultiArrayLayout layout uint64[] data }}, - TopicSpec UInt8{ message { uint8 data }}, - TopicSpec UInt8MultiArray{ message { MultiArrayLayout layout uint8[] data }} - }}, - Package std_srvs{ spec { - ServiceSpec Empty{ request { } response { } }, - ServiceSpec SetBool{ request { bool data } response { bool success string message } }, - ServiceSpec Trigger{ request { } response { bool success string message } } - }} - } -} \ No newline at end of file diff --git a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/theora_image_transport.ros b/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/theora_image_transport.ros deleted file mode 100644 index d9a73aeb2..000000000 --- a/ROSCommonObjects/de.fraunhofer.ipa.ros.communication.objects/basic_msgs/theora_image_transport.ros +++ /dev/null @@ -1,6 +0,0 @@ -PackageSet{package{ - Package theora_image_transport{spec{ - TopicSpec Packet{} - }} - } -} diff --git a/plugins/de.fraunhofer.ipa.rossystem.deployment/.classpath b/plugins/de.fraunhofer.ipa.rossystem.deployment/.classpath new file mode 100644 index 000000000..428337e56 --- /dev/null +++ b/plugins/de.fraunhofer.ipa.rossystem.deployment/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/plugins/de.fraunhofer.ipa.rossystem.deployment/.project b/plugins/de.fraunhofer.ipa.rossystem.deployment/.project new file mode 100644 index 000000000..c2616bc9f --- /dev/null +++ b/plugins/de.fraunhofer.ipa.rossystem.deployment/.project @@ -0,0 +1,34 @@ + + + de.fraunhofer.ipa.rossystem.deployment + + + + + + org.eclipse.xtext.ui.shared.xtextBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.xtext.ui.shared.xtextNature + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/plugins/de.fraunhofer.ipa.rossystem.deployment/.settings/org.eclipse.core.resources.prefs b/plugins/de.fraunhofer.ipa.rossystem.deployment/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 000000000..99f26c020 --- /dev/null +++ b/plugins/de.fraunhofer.ipa.rossystem.deployment/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/plugins/de.fraunhofer.ipa.rossystem.deployment/.settings/org.eclipse.jdt.core.prefs b/plugins/de.fraunhofer.ipa.rossystem.deployment/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..0c68a61dc --- /dev/null +++ b/plugins/de.fraunhofer.ipa.rossystem.deployment/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/plugins/de.fraunhofer.ipa.rossystem.deployment/META-INF/MANIFEST.MF b/plugins/de.fraunhofer.ipa.rossystem.deployment/META-INF/MANIFEST.MF new file mode 100644 index 000000000..994aeb249 --- /dev/null +++ b/plugins/de.fraunhofer.ipa.rossystem.deployment/META-INF/MANIFEST.MF @@ -0,0 +1,18 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: de.fraunhofer.ipa.rossystem.deployment +Bundle-SymbolicName: de.fraunhofer.ipa.rossystem.deployment;singleton:=true +Bundle-Version: 1.5.0.qualifier +Export-Package: de.fraunhofer.ipa.rossystem.deployment +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Import-Package: javax.inject;version="1.0.0", + org.eclipse.ui.handlers, + org.eclipse.xtext.ui.resource +Bundle-ActivationPolicy: lazy +Bundle-Activator: de.fraunhofer.ipa.rossystem.deployment.Activator +Require-Bundle: org.eclipse.xtext.builder, + org.eclipse.xtext.ui, + de.fraunhofer.ipa.rossystem.xtext;bundle-version="1.5.0", + de.fraunhofer.ipa.rossystem.xtext.ide;bundle-version="1.5.0", + de.fraunhofer.ipa.rossystem.xtext.ui;bundle-version="1.5.0", + de.fraunhofer.ipa.rossystem;bundle-version="1.5.0" diff --git a/plugins/de.fraunhofer.ipa.rossystem.deployment/build.properties b/plugins/de.fraunhofer.ipa.rossystem.deployment/build.properties new file mode 100644 index 000000000..b7541b62b --- /dev/null +++ b/plugins/de.fraunhofer.ipa.rossystem.deployment/build.properties @@ -0,0 +1,18 @@ +source.. = src/,\ + xtend-gen/ +bin.includes = .,\ + META-INF/,\ + plugin.xml +bin.excludes = **/*.mwe2,\ + **/*.xtend +additional.bundles = org.eclipse.xtext.xbase,\ + org.eclipse.xtext.common.types,\ + org.eclipse.xtext.xtext.generator,\ + org.eclipse.emf.codegen.ecore,\ + org.eclipse.emf.mwe.utils,\ + org.eclipse.emf.mwe2.lib,\ + org.objectweb.asm,\ + org.apache.commons.logging,\ + org.apache.log4j,\ + com.ibm.icu,\ + org.eclipse.xtext.generator diff --git a/plugins/de.fraunhofer.ipa.rossystem.deployment/plugin.xml b/plugins/de.fraunhofer.ipa.rossystem.deployment/plugin.xml new file mode 100644 index 000000000..53a752438 --- /dev/null +++ b/plugins/de.fraunhofer.ipa.rossystem.deployment/plugin.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/de.fraunhofer.ipa.rossystem.deployment/pom.xml b/plugins/de.fraunhofer.ipa.rossystem.deployment/pom.xml new file mode 100644 index 000000000..492d82d22 --- /dev/null +++ b/plugins/de.fraunhofer.ipa.rossystem.deployment/pom.xml @@ -0,0 +1,31 @@ + + 4.0.0 + + de.fraunhofer.ipa.ros + de.fraunhofer.ipa.ros.parent + 1.5.0-SNAPSHOT + ../de.fraunhofer.ipa.ros.parent/pom.xml + + de.fraunhofer.ipa.rossystem.deployment + eclipse-plugin + + + + + org.eclipse.xtend + xtend-maven-plugin + + + org.apache.maven.plugins + maven-clean-plugin + + + xtend-gen-clean + clean + + + + + + diff --git a/plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/Activator.java b/plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/Activator.java new file mode 100644 index 000000000..5e6b08b79 --- /dev/null +++ b/plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/Activator.java @@ -0,0 +1,7 @@ +package de.fraunhofer.ipa.rossystem.deployment; + +import de.fraunhofer.ipa.rossystem.xtext.ui.internal.XtextActivator; + +public class Activator extends XtextActivator { + +} diff --git a/plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/DeploymentArtifactsGenerator.xtend b/plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/DeploymentArtifactsGenerator.xtend new file mode 100644 index 000000000..4f7cdf223 --- /dev/null +++ b/plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/DeploymentArtifactsGenerator.xtend @@ -0,0 +1,72 @@ +package de.fraunhofer.ipa.rossystem.deployment + +import java.util.Set +import org.eclipse.emf.ecore.resource.Resource +import org.eclipse.xtext.generator.AbstractGenerator +import org.eclipse.xtext.generator.IFileSystemAccess2 +import org.eclipse.xtext.generator.IGeneratorContext +import org.eclipse.xtext.generator.IOutputConfigurationProvider +import org.eclipse.xtext.generator.OutputConfiguration +import de.fraunhofer.ipa.rossystem.deployment.RosInstallCompiler +import de.fraunhofer.ipa.rossystem.deployment.DockerComposeCompiler +import de.fraunhofer.ipa.rossystem.deployment.DockerContainerCompiler +import de.fraunhofer.ipa.rossystem.deployment.GitActionCompiler +import rossystem.RosSystem; + +class CustomOutputProvider implements IOutputConfigurationProvider { + public final static String DEFAULT_OUTPUT = "DEFAULT_OUTPUT" + + + override Set getOutputConfigurations() { + var OutputConfiguration default_config = new OutputConfiguration(DEFAULT_OUTPUT) + default_config.setDescription("DEFAULT_OUTPUT"); + default_config.setOutputDirectory("./src-gen/"); + default_config.setOverrideExistingResources(true); + default_config.setCreateOutputDirectory(true); + default_config.setCleanUpDerivedResources(true); + default_config.setSetDerivedProperty(true); + return newHashSet(default_config) + } +} + +/** + * Generates code from your model files on save. + * + * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#code-generation + */ +class DeploymentArtifactsGenerator extends AbstractGenerator { + + DockerContainerCompiler docker_compiler = new DockerContainerCompiler() + RosInstallCompiler rosintall_compiler = new RosInstallCompiler() + DockerComposeCompiler dockercompose_compiler = new DockerComposeCompiler() + GitActionCompiler gitaction_compiler = new GitActionCompiler() + + + override void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) { + // ROS1 package + for (system : resource.allContents.toIterable.filter(RosSystem)){ + if (system.componentStack.size==0){ + fsa.generateFile(system.getName().toLowerCase+"/Dockerfile",docker_compiler.compile_toDockerContainer(system, null)) + fsa.generateFile(system.getName().toLowerCase+"/extra_layer/" + system.getName().toLowerCase + ".rosinstall",rosintall_compiler.compile_toRosInstall(system,null)) + fsa.generateFile(system.getName().toLowerCase+"/extra_layer/Dockerfile",docker_compiler.compile_toDockerImageExtraLayer(system, null)) + } else { + for (stack : system.componentStack){ + fsa.generateFile(String.join("/", system.getName().toLowerCase, system.name.toLowerCase+'_'+stack.name.toLowerCase, "Dockerfile"),docker_compiler.compile_toDockerContainer(system, stack)) + fsa.generateFile(String.join("/", system.getName().toLowerCase, system.name.toLowerCase+'_'+stack.name.toLowerCase, "extra_layer", stack.name.toLowerCase+".rosinstall"),rosintall_compiler.compile_toRosInstall(system,stack)) + fsa.generateFile(String.join("/", system.getName().toLowerCase, system.name.toLowerCase+'_'+stack.name.toLowerCase, "extra_layer", "Dockerfile"),docker_compiler.compile_toDockerImageExtraLayer(system,stack)) + } + } + fsa.generateFile(String.join("/", system.getName().toLowerCase, "docker-compose.yml"),dockercompose_compiler.compile_toDockerCompose(system)) + } + + // git action workflow + for (system : resource.allContents.toIterable.filter(RosSystem)){ + fsa.generateFile(String.join("/", system.getName().toLowerCase, system.getName().toLowerCase + "_workflow.yml") ,gitaction_compiler.compile_toGitAction(system)) + } + + } + +} + + + diff --git a/plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/DeploymentArtifactsGeneratorExecutableExtensionFactory.java b/plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/DeploymentArtifactsGeneratorExecutableExtensionFactory.java new file mode 100644 index 000000000..d3470060c --- /dev/null +++ b/plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/DeploymentArtifactsGeneratorExecutableExtensionFactory.java @@ -0,0 +1,19 @@ +package de.fraunhofer.ipa.rossystem.deployment; + +import org.eclipse.xtext.ui.guice.AbstractGuiceAwareExecutableExtensionFactory; +import org.osgi.framework.Bundle; + +import com.google.inject.Injector; + +public class DeploymentArtifactsGeneratorExecutableExtensionFactory extends AbstractGuiceAwareExecutableExtensionFactory { + + @Override + protected Bundle getBundle() { + return Activator.getInstance().getBundle(); + } + + @Override + protected Injector getInjector() { + return Activator.getInstance().getInjector(Activator.DE_FRAUNHOFER_IPA_ROSSYSTEM_ROSSYSTEM); + } + } diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/DockerComposeCompiler.xtend b/plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/DockerComposeCompiler.xtend similarity index 52% rename from plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/DockerComposeCompiler.xtend rename to plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/DockerComposeCompiler.xtend index 2f717395a..df9d224a5 100644 --- a/plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/DockerComposeCompiler.xtend +++ b/plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/DockerComposeCompiler.xtend @@ -1,14 +1,13 @@ -package de.fraunhofer.ipa.rossystem.generator +package de.fraunhofer.ipa.rossystem.deployment -import com.google.inject.Inject import rossystem.RosSystem -import rossystem.ComponentStack +import de.fraunhofer.ipa.rossystem.generator.GeneratorHelpers class DockerComposeCompiler { - @Inject extension GeneratorHelpers + GeneratorHelpers generator_helper = new GeneratorHelpers() - def compile_toDockerCompose(RosSystem system) '''«init_pkg()» + def compile_toDockerCompose(RosSystem system) '''«generator_helper.init_pkg()» version: "3.3" networks: ros: @@ -21,6 +20,18 @@ services: networks: - ros +«IF system.getComponentStack().isEmpty()» +«" "»«system.name.toLowerCase»: + image: "«system.name.toLowerCase»:latest" + depends_on: + - ros-master + environment: + - "ROS_MASTER_URI=http://ros-master:11311" + - "ROS_HOSTNAME=«system.name.toLowerCase»" + networks: + - ros + command: stdbuf -o L roslaunch «system.name.toLowerCase» «system.name.toLowerCase».launch --wait +«ELSE» «FOR stack:system.componentStack» «" "»«system.name.toLowerCase»_«stack.name.toLowerCase»: image: "«system.name.toLowerCase»_«stack.name.toLowerCase»:latest" @@ -34,6 +45,7 @@ services: command: stdbuf -o L roslaunch «system.name.toLowerCase»_«stack.name.toLowerCase» «stack.name.toLowerCase».launch --wait «ENDFOR» +«ENDIF» ''' } \ No newline at end of file diff --git a/plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/DockerContainerCompiler.xtend b/plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/DockerContainerCompiler.xtend new file mode 100644 index 000000000..2d5c0c069 --- /dev/null +++ b/plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/DockerContainerCompiler.xtend @@ -0,0 +1,117 @@ +package de.fraunhofer.ipa.rossystem.deployment + +import rossystem.RosSystem +import rossystem.ComponentStack +import de.fraunhofer.ipa.rossystem.generator.GeneratorHelpers + +class DockerContainerCompiler { + GeneratorHelpers generator_helper = new GeneratorHelpers() + + def compile_toDockerContainer(RosSystem system, ComponentStack stack) '''«generator_helper.init_pkg()» +# syntax=docker/dockerfile:experimental +ARG SUFFIX= +ARG BUILDER_SUFFIX=:melodic +ARG PREFIX= +«IF stack===null» + «IF generator_helper.listOfRepos(system).isEmpty()» +FROM ros:melodic-ros-core as base + «ELSE» +FROM ${PREFIX}extra_layer_«system.name.toLowerCase»${SUFFIX} as base + «ENDIF» +«ELSE» + «IF generator_helper.listOfRepos(stack).isEmpty()» +FROM ros:melodic-ros-core as base + «ELSE» +FROM ${PREFIX}extra_layer_«stack.name.toLowerCase»${SUFFIX} as base + «ENDIF» +«ENDIF» +FROM ${PREFIX}builder${BUILDER_SUFFIX} as builder + +FROM base as build +COPY . /root/ws/src/«IF stack===null»«system.name.toLowerCase»«ELSE»«system.name.toLowerCase»_«stack.name.toLowerCase»«ENDIF»/ +RUN --mount=type=bind,from=builder,target=/builder \ + apt-get update -qq && \ + /builder/workspace.bash build_workspace /root/ws && \ + rm -rf /var/lib/apt/lists/* + +FROM build as test +RUN --mount=type=bind,from=builder,target=/builder \ + apt-get update -qq && \ + /builder/workspace.bash test_workspace /root/ws && \ + rm -rf /var/lib/apt/lists/* + +FROM build as install +RUN --mount=type=bind,from=builder,target=/builder \ + apt-get update -qq && \ + /builder/workspace.bash install_workspace /root/ws && \ + rm -rf /var/lib/apt/lists/* + +FROM install as full +RUN --mount=type=bind,from=builder,target=/builder \ + apt-get update -qq && \ + /builder/workspace.bash install_depends /root/ws && \ + rm -rf /var/lib/apt/lists/* + +FROM base as deploy +RUN --mount=type=bind,from=builder,target=/builder --mount=type=bind,target=/root/ws,from=install,source=/root/ws \ + apt-get update -qq && \ + /builder/workspace.bash install_depends /root/ws && \ + rm -rf /var/lib/apt/lists/* +COPY --from=install /opt/ros/$ROS_DISTRO /opt/ros/$ROS_DISTRO + +FROM deploy as launch +«IF stack===null»CMD ["roslaunch", "«system.name»", "«system.name».launch"]«ELSE»CMD ["roslaunch", "«system.name.toLowerCase»_«stack.name.toLowerCase»", "«stack.name.toLowerCase».launch"]«ENDIF» +''' + + def compile_toDockerImageExtraLayer(RosSystem system, ComponentStack stack) '''«generator_helper.init_pkg()» +«IF (stack===null && !generator_helper.listOfRepos(system).isEmpty()) || (stack !==null && !generator_helper.listOfRepos(stack).isEmpty()) » +# syntax=docker/dockerfile:experimental +ARG SUFFIX= +ARG PREFIX= +«««Todo: get distro from model +ARG BUILDER_SUFFIX=:melodic +FROM ros:melodic-ros-core as base +FROM ${PREFIX}builder${BUILDER_SUFFIX} as builder + +FROM base as pre_build +COPY * /root/ws/src/ +RUN --mount=type=bind,from=builder,target=/builder \ + apt-get update -qq && \ + /builder/workspace.bash update_list /root/ws && \ + rm -rf /var/lib/apt/lists/* + +FROM pre_build as build +RUN --mount=type=bind,from=builder,target=/builder \ + apt-get update -qq && \ + /builder/workspace.bash build_workspace /root/ws && \ + rm -rf /var/lib/apt/lists/* + +FROM build as test +RUN --mount=type=bind,from=builder,target=/builder \ + apt-get update -qq && \ + /builder/workspace.bash test_workspace /root/ws && \ + rm -rf /var/lib/apt/lists/* + +FROM build as install +RUN --mount=type=bind,from=builder,target=/builder \ + apt-get update -qq && \ + /builder/workspace.bash install_workspace /root/ws && \ + rm -rf /var/lib/apt/lists/* + +FROM install as full +RUN --mount=type=bind,from=builder,target=/builder \ + apt-get update -qq && \ + /builder/workspace.bash install_depends /root/ws && \ + rm -rf /var/lib/apt/lists/* + +FROM pre_build as deploy +RUN --mount=type=bind,from=builder,target=/builder \ + --mount=type=bind,target=/root/ws,from=install,source=/root/ws \ + apt-get update -qq && \ + /builder/workspace.bash install_depends /root/ws && \ + rm -rf /var/lib/apt/lists/* +COPY --from=install /opt/ros/$ROS_DISTRO /opt/ros/$ROS_DISTRO + «ENDIF» +''' + +} diff --git a/plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/GenerationHandler.java b/plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/GenerationHandler.java new file mode 100644 index 000000000..b45fdf13a --- /dev/null +++ b/plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/GenerationHandler.java @@ -0,0 +1,83 @@ +package de.fraunhofer.ipa.rossystem.deployment; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.IHandler; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.xtext.builder.EclipseResourceFileSystemAccess2; +import org.eclipse.xtext.generator.GeneratorContext; +import org.eclipse.xtext.generator.IOutputConfigurationProvider; +import org.eclipse.xtext.generator.OutputConfiguration; +import org.eclipse.xtext.resource.IResourceDescriptions; +import org.eclipse.xtext.ui.resource.IResourceSetProvider; + +import com.google.inject.Inject; +import com.google.inject.Provider; + +import de.fraunhofer.ipa.rossystem.deployment.CustomOutputProvider; +import de.fraunhofer.ipa.rossystem.deployment.DeploymentArtifactsGenerator; + +public class GenerationHandler extends AbstractHandler implements IHandler { + + @Inject + private Provider fileAccessProvider; + + @Inject + IResourceDescriptions resourceDescriptions; + + @Inject + IResourceSetProvider resourceSetProvider; + + static Map getOutputConfigurationsAsMap(IOutputConfigurationProvider provider) { + Map outputs = new HashMap(); + for(OutputConfiguration c: provider.getOutputConfigurations()) { + outputs.put(c.getName(), c); + } + return outputs; + } + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + + ISelection selection = HandlerUtil.getCurrentSelection(event); + if (selection instanceof IStructuredSelection) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Object firstElement = structuredSelection.getFirstElement(); + if (firstElement instanceof IFile) { + IFile file = (IFile) firstElement; + IProject project = file.getProject(); + + final EclipseResourceFileSystemAccess2 fsa = fileAccessProvider.get(); + fsa.setProject(project); + fsa.setOutputConfigurations(getOutputConfigurationsAsMap(new CustomOutputProvider())); + fsa.setMonitor(new NullProgressMonitor()); + + URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true); + ResourceSet rs = resourceSetProvider.get(project); + Resource r = rs.getResource(uri, true); + + DeploymentArtifactsGenerator generator = new DeploymentArtifactsGenerator(); + generator.doGenerate(r, fsa, new GeneratorContext()); + + } + } + return null; + } + + @Override + public boolean isEnabled() { + return true; + } + } diff --git a/plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/GitActionCompiler.xtend b/plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/GitActionCompiler.xtend new file mode 100644 index 000000000..51686277a --- /dev/null +++ b/plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/GitActionCompiler.xtend @@ -0,0 +1,123 @@ +package de.fraunhofer.ipa.rossystem.deployment + +import rossystem.RosSystem +import de.fraunhofer.ipa.rossystem.generator.GeneratorHelpers + +class GitActionCompiler { + + GeneratorHelpers generator_helper = new GeneratorHelpers() + + def default_part(String layer, String context_path, String needed_layer, String tag)''' +«layer»: + runs-on: ubuntu-latest + «IF needed_layer !== null» + needs: «needed_layer» + «ENDIF» + steps: + - + name: Checkout + uses: actions/checkout@v2 + - name: Log in to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + with: + driver-opts: network=host + - + name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - + name: Docker meta + id: docker_meta + uses: docker/metadata-action@v3 + with: + images: ${{ secrets.DOCKER_USERNAME }}/${{ github.job }} + tags: | + «tag» + type=raw,value=latest + - + name: Get Branch + id: extract_branch + run: echo ::set-output name=branch::$(echo ${GITHUB_REF} | cut -d'/' -f3) + - + name: Build and Push Docker Image + uses: docker/build-push-action@v2 + with: + context: «context_path» + push: true + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} + build-args: | + SUFFIX=:${{ steps.extract_branch.outputs.branch }} + BUILDER_SUFFIX=:${{ env.BUILDER_SUFFIX }} + PREFIX=${{ env.PREFIX }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + - + name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache + ''' + def build_layer()''' + «default_part("builder", "./builder", null, "type=raw,value=${{ env.BUILDER_SUFFIX }}")» +''' + def extra_layer(String name, String path)''' + «default_part("extra_layer_"+name, String.join("/", ".",path,"extra_layer"), "builder", "type=ref,event=branch")» +''' + def system_layer(String sys_name, Boolean need_extra)''' + «IF need_extra» + «default_part(sys_name, "./"+sys_name, "extra_layer_"+sys_name, "type=ref,event=branch")» + «ELSE» + «default_part(sys_name, "./"+sys_name, "builder", "type=ref,event=branch")» + «ENDIF» + ''' + def stack_layer(String sys_name, String stack_name, Boolean need_extra)''' + «IF need_extra» + «default_part(sys_name+"_"+stack_name, String.join("/", ".",sys_name, sys_name+"_"+stack_name), "extra_layer_"+stack_name, "type=ref,event=branch")» + «ELSE» + «default_part(sys_name+"_"+stack_name, String.join("/", ".",sys_name, sys_name+"_"+stack_name), "builder", "type=ref,event=branch")» + «ENDIF» +''' + def compile_toGitAction(RosSystem system) '''«generator_helper.init_pkg()» +name: «system.name.toLowerCase» +on: + push: + paths: + - '«system.name.toLowerCase»/**' +env: + PREFIX: "${{ secrets.DOCKER_USERNAME }}/" + SUFFIX: "" +««« Todo: get distro from model + BUILDER_SUFFIX: melodic +jobs: + «build_layer()» + «IF system.getComponentStack().isEmpty()» + «IF !generator_helper.listOfRepos(system).isEmpty()» + «extra_layer(system.name.toLowerCase, system.name.toLowerCase)» + «system_layer(system.name.toLowerCase, true)» + «ELSE» + «system_layer(system.name.toLowerCase, false)» +«ENDIF» +«ELSE»«FOR stack : system.getComponentStack()»«IF !generator_helper.listOfRepos(stack).isEmpty()» + «extra_layer(stack.name.toLowerCase, String.join("/", system.name.toLowerCase, system.name.toLowerCase + "_" + stack.name.toLowerCase))» + «stack_layer(system.name.toLowerCase, stack.name.toLowerCase, true)» + «ELSE» + «stack_layer(system.name.toLowerCase, stack.name.toLowerCase, false)» +«ENDIF» + «ENDFOR» +«ENDIF» +''' +} \ No newline at end of file diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/RosInstallCompiler.xtend b/plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/RosInstallCompiler.xtend similarity index 70% rename from plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/RosInstallCompiler.xtend rename to plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/RosInstallCompiler.xtend index 591179fcb..1a840adf1 100644 --- a/plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/RosInstallCompiler.xtend +++ b/plugins/de.fraunhofer.ipa.rossystem.deployment/src/de/fraunhofer/ipa/rossystem/deployment/RosInstallCompiler.xtend @@ -1,6 +1,5 @@ -package de.fraunhofer.ipa.rossystem.generator +package de.fraunhofer.ipa.rossystem.deployment -import com.google.inject.Inject import rossystem.RosSystem import java.util.List import componentInterface.ComponentInterface @@ -11,22 +10,30 @@ import java.util.ArrayList import java.util.Set import java.util.HashSet import rossystem.ComponentStack +import de.fraunhofer.ipa.rossystem.generator.GeneratorHelpers class RosInstallCompiler { - @Inject extension GeneratorHelpers PackageImpl component_package; Set Repos; List PkgsList List ComponentsList - - - def compile_toRosInstall (RosSystem system,ComponentStack stack) '''«init_pkg()» + GeneratorHelpers generator_helper = new GeneratorHelpers() + + def create_repo_link (String repo)''' +«IF repo.indexOf(":", repo.indexOf(":") + 1) > 1» +- git: {local-name: «repo.substring(0,repo.lastIndexOf(':')).substring(repo.lastIndexOf("/") + 1).replace(".git","")», uri: «repo.substring(0,repo.lastIndexOf(':'))», version: «repo.substring(repo.lastIndexOf(':') + 1)»} +«ELSE» +- git: {local-name: «repo.substring(repo.lastIndexOf("/") + 1).replace(".git","")», uri: «repo»} +«ENDIF» + ''' + + def compile_toRosInstall (RosSystem system,ComponentStack stack) '''«generator_helper.init_pkg()» «IF stack===null»«FOR repo:system.listOfRepos» -- git: {local-name: «repo.substring(repo.lastIndexOf("/") + 1).replace(".git","")», uri: '«repo»'} +«create_repo_link(repo)» «ENDFOR» «ELSE»«FOR repo:stack.listOfRepos» -- git: {local-name: «repo.substring(repo.lastIndexOf("/") + 1).replace(".git","")», uri: '«repo»'} +«create_repo_link(repo)» «ENDFOR» «ENDIF» ''' @@ -44,7 +51,7 @@ class RosInstallCompiler { Repos = new HashSet(); for (ComponentInterface component: ComponentsList){ component_package = null; - component_package = get_pkg(component); + component_package = generator_helper.get_pkg(component); if (component_package !== null){ if (component_package.fromGitRepo !== null){ Repos.add(component_package.fromGitRepo); @@ -61,4 +68,4 @@ class RosInstallCompiler { return Repos; } -} \ No newline at end of file +} diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/docker-compose.yml b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/docker-compose.yml deleted file mode 100644 index 0d9170954..000000000 --- a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/docker-compose.yml +++ /dev/null @@ -1,35 +0,0 @@ -version: "3.3" -networks: - ros: - driver: bridge - -services: - ros-master: - image: ros:melodic-ros-core - command: stdbuf -o L roscore - networks: - - ros - - test_stacks_stack1: - image: "test_stacks_stack1:latest" - depends_on: - - ros-master - environment: - - "ROS_MASTER_URI=http://ros-master:11311" - - "ROS_HOSTNAME=stack1" - networks: - - ros - command: stdbuf -o L roslaunch test_stacks_stack1 stack1.launch --wait - - test_stacks_stack2: - image: "test_stacks_stack2:latest" - depends_on: - - ros-master - environment: - - "ROS_MASTER_URI=http://ros-master:11311" - - "ROS_HOSTNAME=stack2" - networks: - - ros - command: stdbuf -o L roslaunch test_stacks_stack2 stack2.launch --wait - - diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack1/.rosinstall b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack1/.rosinstall deleted file mode 100644 index fca5e848b..000000000 --- a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack1/.rosinstall +++ /dev/null @@ -1 +0,0 @@ -- git: {local-name: myrepo, uri: 'https://github.com/myTest/myrepo'} diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack1/Dockerfile b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack1/Dockerfile deleted file mode 100644 index 5a9b7f3b8..000000000 --- a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack1/Dockerfile +++ /dev/null @@ -1,40 +0,0 @@ -# syntax=docker/dockerfile:experimental -ARG SUFFIX= -ARG PREFIX= -FROM ros:melodic-ros-core as base -FROM ${PREFIX}builder${SUFFIX} as builder - -FROM base as build -COPY . /root/ws/src/test_stacks_stack1/ -RUN --mount=type=bind,from=builder,target=/builder \ - apt-get update -qq && \ - /builder/workspace.bash build_workspace /root/ws && \ - rm -rf /var/lib/apt/lists/* - -FROM build as test -RUN --mount=type=bind,from=builder,target=/builder \ - apt-get update -qq && \ - /builder/workspace.bash test_workspace /root/ws && \ - rm -rf /var/lib/apt/lists/* - -FROM build as install -RUN --mount=type=bind,from=builder,target=/builder \ - apt-get update -qq && \ - /builder/workspace.bash install_workspace /root/ws && \ - rm -rf /var/lib/apt/lists/* - -FROM install as full -RUN --mount=type=bind,from=builder,target=/builder \ - apt-get update -qq && \ - /builder/workspace.bash install_depends /root/ws && \ - rm -rf /var/lib/apt/lists/* - -FROM base as deploy -RUN --mount=type=bind,from=builder,target=/builder --mount=type=bind,target=/root/ws,from=install,source=/root/ws \ - apt-get update -qq && \ - /builder/workspace.bash install_depends /root/ws && \ - rm -rf /var/lib/apt/lists/* -COPY --from=install /opt/ros/$ROS_DISTRO /opt/ros/$ROS_DISTRO - -FROM deploy as launch -CMD ["roslaunch", "test_stacks_stack1", "stack1.launch"] diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack2/.rosinstall b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack2/.rosinstall deleted file mode 100644 index e69de29bb..000000000 diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack2/Dockerfile b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack2/Dockerfile deleted file mode 100644 index 6892540ed..000000000 --- a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_stacks/test_stacks_stack2/Dockerfile +++ /dev/null @@ -1,40 +0,0 @@ -# syntax=docker/dockerfile:experimental -ARG SUFFIX= -ARG PREFIX= -FROM ros:melodic-ros-core as base -FROM ${PREFIX}builder${SUFFIX} as builder - -FROM base as build -COPY . /root/ws/src/test_stacks_stack2/ -RUN --mount=type=bind,from=builder,target=/builder \ - apt-get update -qq && \ - /builder/workspace.bash build_workspace /root/ws && \ - rm -rf /var/lib/apt/lists/* - -FROM build as test -RUN --mount=type=bind,from=builder,target=/builder \ - apt-get update -qq && \ - /builder/workspace.bash test_workspace /root/ws && \ - rm -rf /var/lib/apt/lists/* - -FROM build as install -RUN --mount=type=bind,from=builder,target=/builder \ - apt-get update -qq && \ - /builder/workspace.bash install_workspace /root/ws && \ - rm -rf /var/lib/apt/lists/* - -FROM install as full -RUN --mount=type=bind,from=builder,target=/builder \ - apt-get update -qq && \ - /builder/workspace.bash install_depends /root/ws && \ - rm -rf /var/lib/apt/lists/* - -FROM base as deploy -RUN --mount=type=bind,from=builder,target=/builder --mount=type=bind,target=/root/ws,from=install,source=/root/ws \ - apt-get update -qq && \ - /builder/workspace.bash install_depends /root/ws && \ - rm -rf /var/lib/apt/lists/* -COPY --from=install /opt/ros/$ROS_DISTRO /opt/ros/$ROS_DISTRO - -FROM deploy as launch -CMD ["roslaunch", "test_stacks_stack2", "stack2.launch"] diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_system/Dockerfile b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_system/Dockerfile deleted file mode 100644 index 0c69f24b4..000000000 --- a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/resources/test_system/Dockerfile +++ /dev/null @@ -1,40 +0,0 @@ -# syntax=docker/dockerfile:experimental -ARG SUFFIX= -ARG PREFIX= -FROM ros:melodic-ros-core as base -FROM ${PREFIX}builder${SUFFIX} as builder - -FROM base as build -COPY . /root/ws/src/test_system/ -RUN --mount=type=bind,from=builder,target=/builder \ - apt-get update -qq && \ - /builder/workspace.bash build_workspace /root/ws && \ - rm -rf /var/lib/apt/lists/* - -FROM build as test -RUN --mount=type=bind,from=builder,target=/builder \ - apt-get update -qq && \ - /builder/workspace.bash test_workspace /root/ws && \ - rm -rf /var/lib/apt/lists/* - -FROM build as install -RUN --mount=type=bind,from=builder,target=/builder \ - apt-get update -qq && \ - /builder/workspace.bash install_workspace /root/ws && \ - rm -rf /var/lib/apt/lists/* - -FROM install as full -RUN --mount=type=bind,from=builder,target=/builder \ - apt-get update -qq && \ - /builder/workspace.bash install_depends /root/ws && \ - rm -rf /var/lib/apt/lists/* - -FROM base as deploy -RUN --mount=type=bind,from=builder,target=/builder --mount=type=bind,target=/root/ws,from=install,source=/root/ws \ - apt-get update -qq && \ - /builder/workspace.bash install_depends /root/ws && \ - rm -rf /var/lib/apt/lists/* -COPY --from=install /opt/ros/$ROS_DISTRO /opt/ros/$ROS_DISTRO - -FROM deploy as launch -CMD ["roslaunch", "test_system", "test_system.launch"] diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/src/de/fraunhofer/ipa/rossystem/tests/RosSystemGeneratorTest.xtend b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/src/de/fraunhofer/ipa/rossystem/tests/RosSystemGeneratorTest.xtend index c65a5471c..c4eecd33c 100644 --- a/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/src/de/fraunhofer/ipa/rossystem/tests/RosSystemGeneratorTest.xtend +++ b/plugins/de.fraunhofer.ipa.rossystem.xtext.tests/src/de/fraunhofer/ipa/rossystem/tests/RosSystemGeneratorTest.xtend @@ -113,14 +113,6 @@ class RosSystemGeneratorTest { Assert.assertEquals(new String(Files.readAllBytes(Paths.get(RESOURCES_BASE_DIR+'/test_system/', 'CMakeLists.txt'))).trim, fsa.textFiles.get(CustomOutputProvider::DEFAULT_OUTPUT+'test_system/CMakeLists.txt').toString.trim) - // Test the generated Dockerfile file - Assert.assertEquals(new String(Files.readAllBytes(Paths.get(RESOURCES_BASE_DIR+'/test_system/', 'Dockerfile'))).trim, - fsa.textFiles.get(CustomOutputProvider::DEFAULT_OUTPUT+'test_system/Dockerfile').toString.trim) - - // Test the generated .rosinstall file - Assert.assertEquals(new String(Files.readAllBytes(Paths.get(RESOURCES_BASE_DIR+'/test_system/', '.rosinstall'))).trim, - fsa.textFiles.get(CustomOutputProvider::DEFAULT_OUTPUT+'test_system/.rosinstall').toString.trim) - // Test the generated component interface Assert.assertEquals(new String(Files.readAllBytes(Paths.get(RESOURCES_BASE_DIR+'/test_system.componentinterface'))).trim, fsa.textFiles.get(CustomOutputProvider::CM_CONFIGURATION + "test_system.componentinterface").toString.trim) @@ -144,8 +136,7 @@ class RosSystemGeneratorTest { Assert.assertTrue(fsa.textFiles.containsKey(String.format("%s/launch/%s.launch", gen_stack_prefix, name))) Assert.assertTrue(fsa.textFiles.containsKey(String.format("%s/package.xml", gen_stack_prefix))) Assert.assertTrue(fsa.textFiles.containsKey(String.format("%s/CMakeLists.txt", gen_stack_prefix))) - Assert.assertTrue(fsa.textFiles.containsKey(String.format("%s/Dockerfile", gen_stack_prefix))) - + // Test the generated launch file Assert.assertEquals(new String(Files.readAllBytes(Paths.get(String.format("%s/launch/%s.launch", stack_prefix, name)))).trim, fsa.textFiles.get(String.format("%s/launch/%s.launch", gen_stack_prefix, name)).toString.trim) @@ -158,17 +149,8 @@ class RosSystemGeneratorTest { Assert.assertEquals(new String(Files.readAllBytes(Paths.get(stack_prefix, 'CMakeLists.txt'))).trim, fsa.textFiles.get(String.format("%s/CMakeLists.txt", gen_stack_prefix)).toString.trim) - // Test the generated component interface - Assert.assertEquals(new String(Files.readAllBytes(Paths.get(stack_prefix, 'Dockerfile'))).trim, - fsa.textFiles.get(String.format("%s/Dockerfile", gen_stack_prefix)).toString.trim) - - // Test the generated component interface - Assert.assertEquals(new String(Files.readAllBytes(Paths.get(stack_prefix, '.rosinstall'))).trim, - fsa.textFiles.get(String.format("%s/.rosinstall", gen_stack_prefix)).toString.trim) } - Assert.assertTrue(fsa.textFiles.containsKey(String.format("%s/docker-compose.yml", gen_system_prefix))) - Assert.assertEquals(new String(Files.readAllBytes(Paths.get(system_prefix, 'docker-compose.yml'))).trim, - fsa.textFiles.get(String.format("%s/docker-compose.yml", gen_system_prefix)).toString.trim) + } } diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/DockerContainerCompiler.xtend b/plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/DockerContainerCompiler.xtend deleted file mode 100644 index 2b495cbad..000000000 --- a/plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/DockerContainerCompiler.xtend +++ /dev/null @@ -1,54 +0,0 @@ -package de.fraunhofer.ipa.rossystem.generator - -import com.google.inject.Inject -import rossystem.RosSystem -import rossystem.ComponentStack - -class DockerContainerCompiler { - - @Inject extension GeneratorHelpers - - def compile_toDockerContainer(RosSystem system, ComponentStack stack) '''«init_pkg()» -# syntax=docker/dockerfile:experimental -ARG SUFFIX= -ARG PREFIX= -FROM ros:melodic-ros-core as base -FROM ${PREFIX}builder${SUFFIX} as builder - -FROM base as build -COPY . /root/ws/src/«IF stack===null»«system.name.toLowerCase»«ELSE»«system.name.toLowerCase»_«stack.name.toLowerCase»«ENDIF»/ -RUN --mount=type=bind,from=builder,target=/builder \ - apt-get update -qq && \ - /builder/workspace.bash build_workspace /root/ws && \ - rm -rf /var/lib/apt/lists/* - -FROM build as test -RUN --mount=type=bind,from=builder,target=/builder \ - apt-get update -qq && \ - /builder/workspace.bash test_workspace /root/ws && \ - rm -rf /var/lib/apt/lists/* - -FROM build as install -RUN --mount=type=bind,from=builder,target=/builder \ - apt-get update -qq && \ - /builder/workspace.bash install_workspace /root/ws && \ - rm -rf /var/lib/apt/lists/* - -FROM install as full -RUN --mount=type=bind,from=builder,target=/builder \ - apt-get update -qq && \ - /builder/workspace.bash install_depends /root/ws && \ - rm -rf /var/lib/apt/lists/* - -FROM base as deploy -RUN --mount=type=bind,from=builder,target=/builder --mount=type=bind,target=/root/ws,from=install,source=/root/ws \ - apt-get update -qq && \ - /builder/workspace.bash install_depends /root/ws && \ - rm -rf /var/lib/apt/lists/* -COPY --from=install /opt/ros/$ROS_DISTRO /opt/ros/$ROS_DISTRO - -FROM deploy as launch -«IF stack===null»CMD ["roslaunch", "«system.name»", "«system.name».launch"]«ELSE»CMD ["roslaunch", "«system.name.toLowerCase»_«stack.name.toLowerCase»", "«stack.name.toLowerCase».launch"]«ENDIF» -''' - -} \ No newline at end of file diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/GeneratorHelpers.xtend b/plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/GeneratorHelpers.xtend index b1795dfff..7b706b6ca 100644 --- a/plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/GeneratorHelpers.xtend +++ b/plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/GeneratorHelpers.xtend @@ -15,6 +15,10 @@ import ros.Node import ros.impl.PackageImpl import rossystem.ComponentStack import org.eclipse.emf.ecore.EObject +import java.util.Set +import java.util.HashSet +import ros.Dependency +import ros.PackageDependency class GeneratorHelpers { @@ -24,6 +28,8 @@ class GeneratorHelpers { List PkgsList String Pkg List ComponentsList + PackageImpl component_package + Set Repos def void init_pkg(){ PackageSet=false @@ -116,5 +122,55 @@ class GeneratorHelpers { package_impl = node.eContainer.eContainer as PackageImpl; return package_impl; } + + +def Set listOfRepos(Object subsystem) { + PkgsList = new ArrayList() + ComponentsList = new ArrayList(); + if (subsystem.class.toString.contains("RosSystemImpl")){ + ComponentsList = (subsystem as RosSystem).rosComponent + } else if (subsystem.class.toString.contains("ComponentStackImpl")) { + ComponentsList = (subsystem as ComponentStack).rosComponent + } + + + Repos = new HashSet(); + for (ComponentInterface component: ComponentsList){ + component_package = null; + component_package = get_pkg(component); + if (component_package !== null){ + if (component_package.fromGitRepo !== null){ + Repos.add(component_package.fromGitRepo); + } + if (!component_package.dependency.empty){ + for (Dependency depend: component_package.dependency){ + if ((depend as PackageDependency).package !== null){ + if ((depend as PackageDependency).package.fromGitRepo !== null){ + Repos.add((depend as PackageDependency).package.fromGitRepo); + } + } + } + }}} + return Repos; +} + + //Launch files generators + def check_ns(ComponentInterface component){ + if (component.hasNS){ + return component.get_ns(); + }else { + return ""; + } + } + def boolean hasNS(ComponentInterface component){ + if(!component.nameSpace.nullOrEmpty){ + return true; + }else{ + return false + } + } + def String get_ns(ComponentInterface component){ + return component.nameSpace.replaceFirst("/",""); + } } diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/LaunchFileCompiler_ROS1.xtend b/plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/LaunchFileCompiler_ROS1.xtend index 54a05dfdd..096882983 100644 --- a/plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/LaunchFileCompiler_ROS1.xtend +++ b/plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/LaunchFileCompiler_ROS1.xtend @@ -19,6 +19,7 @@ import componentInterface.RosActionClient import rossystem.ActionConnection import componentInterface.RosActionServer import rossystem.ComponentStack +import ros.ParameterStructMember class LaunchFileCompiler_ROS1 { @Inject extension GeneratorHelpers @@ -85,14 +86,18 @@ class LaunchFileCompiler_ROS1 { «remapping_function_actc(rosActionClient, component.hasNS, inActionToConnection(rosActionClient, system.actionConnections),component.check_ns)» «ENDFOR» «FOR rosParameter:component.rosparameter» - «IF rosParameter.parameter.type.toString.contains("ParameterStructType")»«str_output=""» - +«IF rosParameter.parameter.type.toString.contains("ParameterStructType")»«str_output=""» + «rosParameter.name»: - «IF rosParameter.value.eContents !== null» - «compile_struct_param(rosParameter.value.eContents,false)» - «ENDIF» - - «ELSE» +«IF rosParameter.value.eContents !== null»«compile_struct_param(rosParameter.value.eContents,false)»«ENDIF» + +«ELSEIF rosParameter.parameter.type.toString.contains("ParameterListType") && rosParameter.parameter.eContents.get(0).eContents.get(0).eClass.toString.contains("ParameterStructType")» + + «rosParameter.name»: + «FOR member: rosParameter.value.eContents»- «FOR submember:member.eContents»«FOR subsubmember:submember.eContents»«(subsubmember as ParameterStructMember).name» : «(subsubmember as ParameterStructMember).value.compile_param_value»«ENDFOR» + «" "»«ENDFOR»«ENDFOR» + +«ELSE» «IF rosParameter.value!==null»«ENDIF» «ENDIF» «ENDFOR» @@ -239,13 +244,7 @@ class LaunchFileCompiler_ROS1 { } // - def check_ns(ComponentInterface component){ - if (component.hasNS){ - return component.get_ns(); - }else { - return ""; - } - } + def String compile_struct_param(List paramMembers,Boolean sub){ if (!sub){ @@ -315,16 +314,6 @@ class LaunchFileCompiler_ROS1 { return ListInterfaceDef } - def boolean hasNS(ComponentInterface component){ - if(!component.nameSpace.nullOrEmpty){ - return true; - }else{ - return false - } - } - def String get_ns(ComponentInterface component){ - return component.nameSpace.replaceFirst("/",""); - } def getParamName (EObject paramdef){ return (paramdef as ParameterStructMemberImpl).name; diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/LaunchFileCompiler_ROS2.xtend b/plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/LaunchFileCompiler_ROS2.xtend index 29ce01418..eff6240e0 100644 --- a/plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/LaunchFileCompiler_ROS2.xtend +++ b/plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/LaunchFileCompiler_ROS2.xtend @@ -50,14 +50,6 @@ def generate_launch_description(): return ld ''' - def check_ns(ComponentInterface component){ - if (component.hasNS){ - return component.get_ns(); - }else { - return ""; - } - } - def List InterfaceDef(String name, String type){ ListInterfaceDef = new ArrayList() ListInterfaceDef.add(name.replace("/","_")) @@ -66,16 +58,6 @@ def generate_launch_description(): return ListInterfaceDef } - def boolean hasNS(ComponentInterface component){ - if(!component.nameSpace.nullOrEmpty){ - return true; - }else{ - return false - } - } - def String get_ns(ComponentInterface component){ - return component.nameSpace.replaceFirst("/",""); - } def String compile_remappings_str(ComponentInterface component) { var remap_str = ""; diff --git a/plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/RosSystemGenerator.xtend b/plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/RosSystemGenerator.xtend index c3d936ef7..2efe01db3 100644 --- a/plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/RosSystemGenerator.xtend +++ b/plugins/de.fraunhofer.ipa.rossystem.xtext/src/de/fraunhofer/ipa/rossystem/generator/RosSystemGenerator.xtend @@ -16,7 +16,7 @@ import rossystem.RosSystem class CustomOutputProvider implements IOutputConfigurationProvider { public final static String CM_CONFIGURATION = "CM_CONFIGURATION" public final static String DEFAULT_OUTPUT = "DEFAULT_OUTPUT" - + override Set getOutputConfigurations() { var OutputConfiguration cm_config = new OutputConfiguration(CM_CONFIGURATION) @@ -46,12 +46,8 @@ class RosSystemGenerator extends AbstractGenerator { @Inject extension LaunchFileCompiler_ROS1 @Inject extension LaunchFileCompiler_ROS2 @Inject extension SetupPyCompile - @Inject extension DockerComposeCompiler - @Inject extension DockerContainerCompiler - @Inject extension RosInstallCompiler - //@Inject extension InstallScriptCompiler - + override void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) { for (system : resource.allContents.toIterable.filter(RosSystem)){ @@ -68,18 +64,12 @@ class RosSystemGenerator extends AbstractGenerator { fsa.generateFile(system.getName().toLowerCase+"/package.xml",compile_package_xml_format2(system, null)) fsa.generateFile(system.getName().toLowerCase+"/CMakeLists.txt",compile_CMakeLists_ROS1(system, null)) fsa.generateFile(system.getName().toLowerCase+"/launch/"+system.getName()+".launch",compile_toROS1launch(system, null).toString().replace("\t"," ")) - fsa.generateFile(system.getName().toLowerCase+"/Dockerfile",compile_toDockerContainer(system, null)) - fsa.generateFile(system.getName().toLowerCase+"/.rosinstall",compile_toRosInstall(system,null)) } else { for (stack : system.componentStack){ fsa.generateFile(String.join("/", system.getName().toLowerCase, system.name.toLowerCase+'_'+stack.name.toLowerCase, "package.xml"),compile_package_xml_format2(system, stack)) fsa.generateFile(String.join("/", system.getName().toLowerCase, system.name.toLowerCase+'_'+stack.name.toLowerCase, "CMakeLists.txt"),compile_CMakeLists_ROS1(system, stack)) fsa.generateFile(String.join("/", system.getName().toLowerCase, system.name.toLowerCase+'_'+stack.name.toLowerCase, "launch", stack.getName()+".launch"), compile_toROS1launch(system, stack).toString().replace("\t"," ")) - fsa.generateFile(String.join("/", system.getName().toLowerCase, system.name.toLowerCase+'_'+stack.name.toLowerCase, "Dockerfile"),compile_toDockerContainer(system, stack)) - fsa.generateFile(String.join("/", system.getName().toLowerCase, system.name.toLowerCase+'_'+stack.name.toLowerCase,".rosinstall"),compile_toRosInstall(system,stack)) - } - fsa.generateFile(String.join("/", system.getName().toLowerCase, "docker-compose.yml"),compile_toDockerCompose(system)) } } @@ -94,4 +84,3 @@ class RosSystemGenerator extends AbstractGenerator { } } } -