From 71e197d3533e8e93db69c446d1521df506962e15 Mon Sep 17 00:00:00 2001 From: RonaldsonBellande Date: Mon, 22 Jul 2024 16:58:01 -0400 Subject: [PATCH] latest pushes --- .github/workflows/clone.yml | 90 +++++++++++++ git_scripts/.gitignore | 3 + ...elligence_control_system_bringup.launch.py | 76 +++++++++++ ...rol_system_bringup_visualization.launch.py | 85 ++++++++++++ ...intelligence_control_system_bringup.launch | 15 +++ ...ontrol_system_bringup_visualization.launch | 22 ++++ ...igence_control_system_read_write.launch.py | 121 ++++++++++++++++++ ...elligence_control_system_read_write.launch | 34 +++++ .../setup.py | 15 +++ 9 files changed, 461 insertions(+) create mode 100644 .github/workflows/clone.yml create mode 100644 git_scripts/.gitignore create mode 100644 humanoid_robot_intelligence_control_system_bringup/launch/humanoid_robot_intelligence_control_system_bringup.launch.py create mode 100644 humanoid_robot_intelligence_control_system_bringup/launch/humanoid_robot_intelligence_control_system_bringup_visualization.launch.py create mode 100644 humanoid_robot_intelligence_control_system_bringup/launch/ros1/humanoid_robot_intelligence_control_system_bringup.launch create mode 100644 humanoid_robot_intelligence_control_system_bringup/launch/ros1/humanoid_robot_intelligence_control_system_bringup_visualization.launch create mode 100644 humanoid_robot_intelligence_control_system_read_write_demo/launch/humanoid_robot_intelligence_control_system_read_write.launch.py create mode 100644 humanoid_robot_intelligence_control_system_read_write_demo/launch/ros1/humanoid_robot_intelligence_control_system_read_write.launch diff --git a/.github/workflows/clone.yml b/.github/workflows/clone.yml new file mode 100644 index 0000000..074054b --- /dev/null +++ b/.github/workflows/clone.yml @@ -0,0 +1,90 @@ +name: GitHub Clone Count Update Everyday + +on: + schedule: + - cron: "0 */24 * * *" + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: gh login + run: echo "${{ secrets.SECRET_TOKEN }}" | gh auth login --with-token + + - name: parse latest clone count + run: | + curl --user "${{ github.actor }}:${{ secrets.SECRET_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/${{ github.repository }}/traffic/clones \ + > clone.json + + - name: create gist and download previous count + id: set_id + run: | + if gh secret list | grep -q "GIST_ID" + then + echo "GIST_ID found" + echo "GIST=${{ secrets.GIST_ID }}" >> $GITHUB_OUTPUT + curl https://gist.githubusercontent.com/${{ github.actor }}/${{ secrets.GIST_ID }}/raw/clone.json > clone_before.json + if cat clone_before.json | grep '404: Not Found'; then + echo "GIST_ID not valid anymore. Creating another gist..." + gist_id=$(gh gist create clone.json | awk -F / '{print $NF}') + echo $gist_id | gh secret set GIST_ID + echo "GIST=$gist_id" >> $GITHUB_OUTPUT + cp clone.json clone_before.json + git rm --ignore-unmatch CLONE.md + fi + else + echo "GIST_ID not found. Creating a gist..." + gist_id=$(gh gist create clone.json | awk -F / '{print $NF}') + echo $gist_id | gh secret set GIST_ID + echo "GIST=$gist_id" >> $GITHUB_OUTPUT + cp clone.json clone_before.json + fi + + - name: update clone.json + run: | + curl https://raw.githubusercontent.com/MShawon/github-clone-count-badge/master/main.py > main.py + python3 main.py + + - name: Update gist with latest count + run: | + content=$(sed -e 's/\\/\\\\/g' -e 's/\t/\\t/g' -e 's/\"/\\"/g' -e 's/\r//g' "clone.json" | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g') + echo '{"description": "${{ github.repository }} clone statistics", "files": {"clone.json": {"content": "'"$content"'"}}}' > post_clone.json + curl -s -X PATCH \ + --user "${{ github.actor }}:${{ secrets.SECRET_TOKEN }}" \ + -H "Content-Type: application/json" \ + -d @post_clone.json https://api.github.com/gists/${{ steps.set_id.outputs.GIST }} > /dev/null 2>&1 + + if [ ! -f CLONE.md ]; then + shields="https://img.shields.io/badge/dynamic/json?color=success&label=Clone&query=count&url=" + url="https://gist.githubusercontent.com/${{ github.actor }}/${{ steps.set_id.outputs.GIST }}/raw/clone.json" + repo="https://github.com/MShawon/github-clone-count-badge" + echo ''> CLONE.md + echo ' + **Markdown** + + ```markdown' >> CLONE.md + echo "[![GitHub Clones]($shields$url&logo=github)]($repo)" >> CLONE.md + echo ' + ``` + + **HTML** + ```html' >> CLONE.md + echo "GitHub Clones" >> CLONE.md + echo '```' >> CLONE.md + + git add CLONE.md + git config --global user.name "GitHub Action" + git config --global user.email "action@github.com" + git commit -m "create clone count badge" + fi + + - name: Push + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/git_scripts/.gitignore b/git_scripts/.gitignore new file mode 100644 index 0000000..e5a7a9c --- /dev/null +++ b/git_scripts/.gitignore @@ -0,0 +1,3 @@ +fix_errors.sh +push.sh +repository_recal.sh diff --git a/humanoid_robot_intelligence_control_system_bringup/launch/humanoid_robot_intelligence_control_system_bringup.launch.py b/humanoid_robot_intelligence_control_system_bringup/launch/humanoid_robot_intelligence_control_system_bringup.launch.py new file mode 100644 index 0000000..9b89968 --- /dev/null +++ b/humanoid_robot_intelligence_control_system_bringup/launch/humanoid_robot_intelligence_control_system_bringup.launch.py @@ -0,0 +1,76 @@ +# Copyright (C) 2024 Bellande Robotics Sensors Research Innovation Center, Ronaldson Bellande +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import os +import sys +import subprocess +from launch import LaunchDescription +from launch_ros.actions import Node +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + + +def ros1_launch_description(): + # Get command-line arguments + args = sys.argv[1:] + + # Construct the ROS 1 launch commandi + roslaunch_command = ["roslaunch", "humanoid_robot_intelligence_control_system_bringup", "humanoid_robot_intelligence_control_system_bringup.launch"] + args + + # Execute the launch command + subprocess.call(roslaunch_command) + + +def ros2_launch_description(): + # Create a list to hold all nodes to be launched + nodes_to_launch = [] + + # Add the HUMANOID_ROBOT Manager launch file + nodes_to_launch.append(IncludeLaunchDescription( + PythonLaunchDescriptionSource([ + '$(find humanoid_robot_intelligence_control_system_manager)/launch/', + 'humanoid_robot_intelligence_control_system_manager.launch.py' + ]) + )) + + # Add the UVC camera node + nodes_to_launch.append(Node( + package='usb_cam', + executable='usb_cam_node', + name='usb_cam_node', + output='screen', + parameters=[{ + 'video_device': '/dev/video0', + 'image_width': 1280, + 'image_height': 720, + 'framerate': 30, + 'camera_frame_id': 'cam_link', + 'camera_name': 'camera' + }] + )) + + # Return the LaunchDescription containing all nodes + return LaunchDescription(nodes_to_launch) + + +if __name__ == "__main__": + ros_version = os.getenv("ROS_VERSION") + if ros_version == "1": + ros1_launch_description() + elif ros_version == "2": + ros2_launch_description() + else: + print("Unsupported ROS version. Please set the ROS_VERSION environment variable to '1' for ROS 1 or '2' for ROS 2.") + sys.exit(1) diff --git a/humanoid_robot_intelligence_control_system_bringup/launch/humanoid_robot_intelligence_control_system_bringup_visualization.launch.py b/humanoid_robot_intelligence_control_system_bringup/launch/humanoid_robot_intelligence_control_system_bringup_visualization.launch.py new file mode 100644 index 0000000..ac4898f --- /dev/null +++ b/humanoid_robot_intelligence_control_system_bringup/launch/humanoid_robot_intelligence_control_system_bringup_visualization.launch.py @@ -0,0 +1,85 @@ +# Copyright (C) 2024 Bellande Robotics Sensors Research Innovation Center, Ronaldson Bellande +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import os +import sys +import subprocess +from launch import LaunchDescription +from launch_ros.actions import Node +from launch.actions import IncludeLaunchDescription, ExecuteProcess +from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch.substitutions import FindExecutable, Command + + + +def ros1_launch_description(): + # Get command-line arguments + args = sys.argv[1:] + + # Construct the ROS 1 launch command + roslaunch_command = ["roslaunch", "humanoid_robot_intelligence_control_system_bringup", "humanoid_robot_intelligence_control_system_bringup_visualization.launch"] + args + + # Execute the launch command + subprocess.call(roslaunch_command) + + +def ros2_launch_description(): + # Create a list to hold all nodes to be launched + nodes_to_launch = [] + + # Add robot description + nodes_to_launch.append(ExecuteProcess( + cmd=[FindExecutable(name='xacro'), '$(find humanoid_robot_intelligence_control_system_description)/urdf/humanoid_robot_intelligence_control_system.urdf.xacro'], + output='screen' + )) + + # Add joint state publisher + nodes_to_launch.append(Node( + package='joint_state_publisher', + executable='joint_state_publisher', + name='joint_state_publisher', + parameters=[{'use_gui': True}], + remappings=[('/robot/joint_states', '/humanoid_robot_intelligence_control_system/present_joint_states')] + )) + + # Add robot state publisher + nodes_to_launch.append(Node( + package='robot_state_publisher', + executable='robot_state_publisher', + name='robot_state_publisher', + remappings=[('/joint_states', '/humanoid_robot_intelligence_control_system/present_joint_states')] + )) + + # Add rviz + nodes_to_launch.append(Node( + package='rviz2', + executable='rviz2', + name='rviz2', + arguments=['-d', '$(find humanoid_robot_intelligence_control_system_bringup)/rviz/humanoid_robot_intelligence_control_system_bringup.rviz'] + )) + + # Return the LaunchDescription containing all nodes + return LaunchDescription(nodes_to_launch) + + +if __name__ == "__main__": + ros_version = os.getenv("ROS_VERSION") + if ros_version == "1": + ros1_launch_description() + elif ros_version == "2": + ros2_launch_description() + else: + print("Unsupported ROS version. Please set the ROS_VERSION environment variable to '1' for ROS 1 or '2' for ROS 2.") + sys.exit(1) diff --git a/humanoid_robot_intelligence_control_system_bringup/launch/ros1/humanoid_robot_intelligence_control_system_bringup.launch b/humanoid_robot_intelligence_control_system_bringup/launch/ros1/humanoid_robot_intelligence_control_system_bringup.launch new file mode 100644 index 0000000..d9f4f02 --- /dev/null +++ b/humanoid_robot_intelligence_control_system_bringup/launch/ros1/humanoid_robot_intelligence_control_system_bringup.launch @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/humanoid_robot_intelligence_control_system_bringup/launch/ros1/humanoid_robot_intelligence_control_system_bringup_visualization.launch b/humanoid_robot_intelligence_control_system_bringup/launch/ros1/humanoid_robot_intelligence_control_system_bringup_visualization.launch new file mode 100644 index 0000000..7c8a537 --- /dev/null +++ b/humanoid_robot_intelligence_control_system_bringup/launch/ros1/humanoid_robot_intelligence_control_system_bringup_visualization.launch @@ -0,0 +1,22 @@ + + + + + + + + + [/humanoid_robot_intelligence_control_system/present_joint_states] + + + + + + + + + + diff --git a/humanoid_robot_intelligence_control_system_read_write_demo/launch/humanoid_robot_intelligence_control_system_read_write.launch.py b/humanoid_robot_intelligence_control_system_read_write_demo/launch/humanoid_robot_intelligence_control_system_read_write.launch.py new file mode 100644 index 0000000..dbdd3ba --- /dev/null +++ b/humanoid_robot_intelligence_control_system_read_write_demo/launch/humanoid_robot_intelligence_control_system_read_write.launch.py @@ -0,0 +1,121 @@ +# Copyright (C) 2024 Bellande Robotics Sensors Research Innovation Center, Ronaldson Bellande +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import os +import sys +import subprocess +from launch import LaunchDescription +from launch_ros.actions import Node +from launch.actions import DeclareLaunchArgument +from launch.substitutions import LaunchConfiguration + + +def ros1_launch_description(): + # Get command-line arguments + args = sys.argv[1:] + + # Construct the ROS 1 launch command + roslaunch_command = ["roslaunch", "humanoid_robot_intelligence_control_system_read_write_demo", "humanoid_robot_intelligence_control_system_read_write.launch"] + args + + # Add parameters + roslaunch_command.extend([ + "gazebo:=false", + "gazebo_robot_name:=humanoid_robot_intelligence_control_system", + "offset_file_path:=$(find humanoid_robot_intelligence_control_system_manager)/config/offset.yaml", + "robot_file_path:=$(find humanoid_robot_intelligence_control_system_manager)/config/HUMANOID_ROBOT.robot", + "init_file_path:=$(find humanoid_robot_intelligence_control_system_manager)/config/dxl_init_HUMANOID_ROBOT.yaml", + "device_name:=/dev/ttyUSB0", + "/humanoid_robot_intelligence_control_system/direct_control/default_moving_time:=0.04", + "/humanoid_robot_intelligence_control_system/direct_control/default_moving_angle:=90" + ]) + + # Add nodes + roslaunch_command.extend([ + "humanoid_robot_intelligence_control_system_manager", "humanoid_robot_intelligence_control_system_manager", "angle_unit:=30", + "humanoid_robot_intelligence_control_system_localization", "humanoid_robot_intelligence_control_system_localization", + "humanoid_robot_intelligence_control_system_read_write_demo", "read_write" + ]) + + # Execute the launch command + subprocess.call(roslaunch_command) + + +def ros2_launch_description(): + # Declare launch arguments + gazebo_arg = DeclareLaunchArgument('gazebo', default_value='false') + gazebo_robot_name_arg = DeclareLaunchArgument('gazebo_robot_name', default_value='humanoid_robot_intelligence_control_system') + offset_file_path_arg = DeclareLaunchArgument('offset_file_path', default_value='$(find humanoid_robot_intelligence_control_system_manager)/config/offset.yaml') + robot_file_path_arg = DeclareLaunchArgument('robot_file_path', default_value='$(find humanoid_robot_intelligence_control_system_manager)/config/HUMANOID_ROBOT.robot') + init_file_path_arg = DeclareLaunchArgument('init_file_path', default_value='$(find humanoid_robot_intelligence_control_system_manager)/config/dxl_init_HUMANOID_ROBOT.yaml') + device_name_arg = DeclareLaunchArgument('device_name', default_value='/dev/ttyUSB0') + + # Create a list to hold all nodes to be launched + nodes_to_launch = [] + + # Add HUMANOID_ROBOT Manager node + nodes_to_launch.append(Node( + package='humanoid_robot_intelligence_control_system_manager', + executable='humanoid_robot_intelligence_control_system_manager', + name='humanoid_robot_intelligence_control_system_manager', + output='screen', + parameters=[ + {'angle_unit': 30}, + {'gazebo': LaunchConfiguration('gazebo')}, + {'gazebo_robot_name': LaunchConfiguration('gazebo_robot_name')}, + {'offset_file_path': LaunchConfiguration('offset_file_path')}, + {'robot_file_path': LaunchConfiguration('robot_file_path')}, + {'init_file_path': LaunchConfiguration('init_file_path')}, + {'device_name': LaunchConfiguration('device_name')}, + {'/humanoid_robot_intelligence_control_system/direct_control/default_moving_time': 0.04}, + {'/humanoid_robot_intelligence_control_system/direct_control/default_moving_angle': 90} + ] + )) + + # Add HUMANOID_ROBOT Localization node + nodes_to_launch.append(Node( + package='humanoid_robot_intelligence_control_system_localization', + executable='humanoid_robot_intelligence_control_system_localization', + name='humanoid_robot_intelligence_control_system_localization', + output='screen' + )) + + # Add HUMANOID_ROBOT Read-Write demo node + nodes_to_launch.append(Node( + package='humanoid_robot_intelligence_control_system_read_write_demo', + executable='read_write', + name='humanoid_robot_intelligence_control_system_read_write', + output='screen' + )) + + # Return the LaunchDescription containing all nodes and arguments + return LaunchDescription([ + gazebo_arg, + gazebo_robot_name_arg, + offset_file_path_arg, + robot_file_path_arg, + init_file_path_arg, + device_name_arg + ] + nodes_to_launch) + + +if __name__ == "__main__": + ros_version = os.getenv("ROS_VERSION") + if ros_version == "1": + ros1_launch_description() + elif ros_version == "2": + ros2_launch_description() + else: + print("Unsupported ROS version. Please set the ROS_VERSION environment variable to '1' for ROS 1 or '2' for ROS 2.") + sys.exit(1) diff --git a/humanoid_robot_intelligence_control_system_read_write_demo/launch/ros1/humanoid_robot_intelligence_control_system_read_write.launch b/humanoid_robot_intelligence_control_system_read_write_demo/launch/ros1/humanoid_robot_intelligence_control_system_read_write.launch new file mode 100644 index 0000000..8bf520d --- /dev/null +++ b/humanoid_robot_intelligence_control_system_read_write_demo/launch/ros1/humanoid_robot_intelligence_control_system_read_write.launch @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/humanoid_robot_intelligence_control_system_read_write_demo/setup.py b/humanoid_robot_intelligence_control_system_read_write_demo/setup.py index 723c5aa..317c74c 100644 --- a/humanoid_robot_intelligence_control_system_read_write_demo/setup.py +++ b/humanoid_robot_intelligence_control_system_read_write_demo/setup.py @@ -1,3 +1,18 @@ +# Copyright (C) 2024 Bellande Robotics Sensors Research Innovation Center, Ronaldson Bellande +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + from distutils.core import setup from catkin_pkg.python_setup import generate_distutils_setup