Compare commits

...

2 Commits

Author SHA1 Message Date
Camille CONJAT 4f05f80975 svgd 2023-12-14 12:01:49 +01:00
Camille CONJAT 399f1bd18c marche je crois 2023-12-14 10:35:14 +01:00
12 changed files with 108 additions and 9 deletions

View File

View File

@ -0,0 +1,13 @@
# Catkin Tools Metadata
This directory was generated by catkin_tools and it contains persistent
configuration information used by the `catkin` command and its sub-commands.
Each subdirectory of the `profiles` directory contains a set of persistent
configuration options for separate profiles. The default profile is called
`default`. If another profile is desired, it can be described in the
`profiles.yaml` file in this directory.
Please see the catkin_tools documentation before editing any files in this
directory. Most actions can be performed with the `catkin` command-line
program.

View File

@ -0,0 +1 @@
0.9.0

View File

@ -0,0 +1,22 @@
authors: []
blacklist: []
build_space: build
catkin_make_args: []
cmake_args: []
devel_layout: linked
devel_space: devel
extend_path: null
extends: null
install: false
install_space: install
isolate_install: false
jobs_args: []
licenses:
- TODO
log_space: logs
maintainers: []
make_args: []
source_space: src
use_env_cache: false
use_internal_make_jobserver: true
whitelist: []

View File

@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.0.2)
project(poppy_ros)
set (OpenCV_DIR "/usr/lib/opencv")
## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)
@ -9,8 +11,13 @@ project(poppy_ros)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
geometry_msgs
message_generation
)
find_package(OpenCV REQUIRED COMPONENTS
core
)
## System dependencies are found with CMake's conventions
@ -68,10 +75,7 @@ find_package(catkin REQUIRED COMPONENTS
# )
## Generate added messages and services with any dependencies listed here
# generate_messages(
# DEPENDENCIES
# std_msgs
# )
################################################
## Declare ROS dynamic reconfigure parameters ##
@ -116,7 +120,12 @@ catkin_package(
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
# include
/home/ros/SOFTWARE/toolkit-dynamixel
/home/ros/SOFTWARE/toolkit-dynamixel/include
/home/ros/SOFTWARE/toolkit-kinematics
/home/ros/SOFTWARE/toolkit-kinematics/include
${OpenCV_INCLUDE_DIRS}
/home/ros/SOFTWARE/eigen/Eigen
${catkin_INCLUDE_DIRS}
)
@ -134,6 +143,7 @@ include_directories(
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide
# add_executable(${PROJECT_NAME}_node src/poppy_ros_node.cpp)
add_executable(poppy_ros src/poppy_ros.cpp /home/ros/SOFTWARE/toolkit-dynamixel/src/DynamixelHandler.cpp)
## Rename C++ executable without prefix
## The above recommended prefix causes long target names, the following renames the
@ -149,6 +159,7 @@ include_directories(
# target_link_libraries(${PROJECT_NAME}_node
# ${catkin_LIBRARIES}
# )
target_link_libraries(poppy_ros dxl_x64_cpp rt ${catkin_LIBRARIES})
#############
## Install ##

View File

@ -0,0 +1 @@
catkin build

View File

@ -0,0 +1,6 @@
devel_space: /home/ros/catkin_ws/src/poppy_ros/devel
install: false
install_space: /home/ros/catkin_ws/src/poppy_ros/install
profile: default
source_space: /home/ros/catkin_ws/src/poppy_ros/src
workspace: /home/ros/catkin_ws/src/poppy_ros

View File

@ -0,0 +1 @@
catkin build

View File

@ -0,0 +1,18 @@
#include <iostream>
#include "ros/ros.h"
#include "poppy_ros/ik.h"
int main(int argc, char** argv)
{
ros::init(argc, argv, <node_name>);
ros::NodeHandle nh;
ros::ServiceClient client = nh.serviceClient<poppy_ros::ik>(ik);
poppy_ros::ik srv;
srv.request.a = 1;
srv.request.b = 2;
if (client.call(srv))
{
std::cout << srv.response.sum << std::endl;
}
return 0;
}

View File

@ -0,0 +1,16 @@
#include "ros/ros.h"
#include "poppy_ros/ik.h"
#include "opencv2/opencv.hpp"
bool ik( poppy_ros::ik::Request& req, poppy_ros::ik::Response& res)
{
res.j1 = 0;# azerfozerjmoj,azemf, !
return true;
}
int main(int argc, char** argv)
{
ros::init(argc, argv, <node_name>);
ros::NodeHandle nh;
ros::ServiceServer server = nh.advertiseService(ik, add);
ros::spin();
return 0;
}

View File

@ -1,6 +1,5 @@
#include "ros/ros.h"
#include "geometry_msgs/Twist.h"
#include "std_msgs/Float64MultiArray.msg"
#include "DynamixelHandler.h"
// Global variables
@ -30,7 +29,7 @@ void jointCMDCallback(const geometry_msgs::Twist& joint_cmd)
jointVec.push_back(joint_cmd.angular.y);
jointVec.push_back(joint_cmd.angular.z);
//call sendTargetJOintPosition(vector) of DxlHandler
_oDxlHandler.sendtargetJointPosition(jointVec);
_oDxlHandler.sendTargetJointPosition(jointVec);
}
int convertAnglesToJointCmd(float fJointAngle)
@ -56,7 +55,7 @@ int main(int argc, char** argv)
_jointPositionPublisher = nh.advertise<geometry_msgs::Twist>("joint_position", 1);
//create a subscriber
ros::Subscriber sub = nh.suscribe("joint_cmd",1, jointCMDCallback);
ros::Subscriber sub = nh.subscribe("joint_cmd",1, jointCMDCallback);
// create a loop rate
ros::Rate loopRate(_fps);

11
poppy_ros/srv/ik.srv Normal file
View File

@ -0,0 +1,11 @@
int64 x
int64 y
int64 z
int64 w
---
int64 j1
int64 j2
int64 j3
int64 j4
int64 j5
int64 j6