Merge pull request #25 from RonaldsonBellande/main

latest pushes
This commit is contained in:
Ronaldson Bellande 2024-07-22 16:58:37 -04:00 committed by GitHub
commit 1e09addc8b
9 changed files with 461 additions and 0 deletions

90
.github/workflows/clone.yml vendored Normal file
View File

@ -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 "<a href='$repo'><img alt='GitHub Clones' src='$shields$url&logo=github'></a>" >> 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 }}

3
git_scripts/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
fix_errors.sh
push.sh
repository_recal.sh

View File

@ -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 <https://www.gnu.org/licenses/>.
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)

View File

@ -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 <https://www.gnu.org/licenses/>.
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)

View File

@ -0,0 +1,15 @@
<?xml version="1.0"?>
<launch>
<!-- HUMANOID_ROBOT Manager -->
<include file="$(find humanoid_robot_intelligence_control_system_manager)/launch/humanoid_robot_intelligence_control_system_manager.launch" />
<!-- UVC camera -->
<node pkg="usb_cam" type="usb_cam_node" name="usb_cam_node" output="screen">
<param name="video_device" type="string" value="/dev/video0" />
<param name="image_width" type="int" value="1280" />
<param name="image_height" type="int" value="720" />
<param name="framerate " type="int" value="30" />
<param name="camera_frame_id" type="string" value="cam_link" />
<param name="camera_name" type="string" value="camera" />
</node>
</launch>

View File

@ -0,0 +1,22 @@
<?xml version="1.0"?>
<launch>
<param name="robot_description"
command="$(find xacro)/xacro.py '$(find humanoid_robot_intelligence_control_system_description)/urdf/humanoid_robot_intelligence_control_system.urdf.xacro'" />
<!-- Send fake joint values and monitoring present joint angle -->
<node pkg="joint_state_publisher" type="joint_state_publisher" name="joint_state_publisher">
<param name="use_gui" value="TRUE" />
<rosparam param="/source_list">
[/humanoid_robot_intelligence_control_system/present_joint_states]</rosparam>
</node>
<!-- Combine joint values -->
<node pkg="robot_state_publisher" type="state_publisher" name="robot_state_publisher">
<remap from="/joint_states"
to="/humanoid_robot_intelligence_control_system/present_joint_states" />
</node>
<!-- Show in Rviz -->
<node pkg="rviz" type="rviz" name="rviz"
args="-d $(find humanoid_robot_intelligence_control_system_bringup)/rviz/humanoid_robot_intelligence_control_system_bringup.rviz" />
</launch>

View File

@ -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 <https://www.gnu.org/licenses/>.
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)

View File

@ -0,0 +1,34 @@
<?xml version="1.0"?>
<launch>
<param name="gazebo" value="false" type="bool" />
<param name="gazebo_robot_name" value="humanoid_robot_intelligence_control_system" />
<param name="offset_file_path"
value="$(find humanoid_robot_intelligence_control_system_manager)/config/offset.yaml" />
<param name="robot_file_path"
value="$(find humanoid_robot_intelligence_control_system_manager)/config/HUMANOID_ROBOT.robot" />
<param name="init_file_path"
value="$(find humanoid_robot_intelligence_control_system_manager)/config/dxl_init_HUMANOID_ROBOT.yaml" />
<param name="device_name" value="/dev/ttyUSB0" />
<param name="/humanoid_robot_intelligence_control_system/direct_control/default_moving_time"
value="0.04" />
<param name="/humanoid_robot_intelligence_control_system/direct_control/default_moving_angle"
value="90" />
<!-- HUMANOID_ROBOT Manager -->
<node pkg="humanoid_robot_intelligence_control_system_manager"
type="humanoid_robot_intelligence_control_system_manager"
name="humanoid_robot_intelligence_control_system_manager" output="screen">
<param name="angle_unit" value="30" />
</node>
<!-- HUMANOID_ROBOT Localization -->
<node pkg="humanoid_robot_intelligence_control_system_localization"
type="humanoid_robot_intelligence_control_system_localization"
name="humanoid_robot_intelligence_control_system_localization" output="screen" />
<!-- HUMANOID_ROBOT Read-Write demo -->
<node pkg="humanoid_robot_intelligence_control_system_read_write_demo" type="read_write"
name="humanoid_robot_intelligence_control_system_read_write" output="screen" />
</launch>

View File

@ -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 <https://www.gnu.org/licenses/>.
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup