From: Walter Fetter Lages Date: Sun, 18 Nov 2018 01:41:49 +0000 (-0200) Subject: Initial Melodic commit. X-Git-Url: http://git.ece.ufrgs.br/?a=commitdiff_plain;h=ee4b99a863e8077afbb84e524cff97e3b51ea6c8;p=gazebo_ros_electrical.git Initial Melodic commit. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index a862a37..5b5a787 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.3) project(gazebo_ros_electrical) ## Compile as C++11, supported in ROS Kinetic and newer -# add_compile_options(-std=c++11) +add_compile_options(-std=c++11) ## Find catkin macros and libraries ## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) @@ -18,7 +18,7 @@ find_package(catkin REQUIRED COMPONENTS roscpp transmission_interface urdf - voltage_controllers + electrical_interface ) ## System dependencies are found with CMake's conventions @@ -114,7 +114,7 @@ find_package(gazebo REQUIRED) catkin_package( INCLUDE_DIRS include LIBRARIES gazebo_ros_electrical -# CATKIN_DEPENDS angles control_toolbox gazebo hardware_interface joint_limits_interface pluginlib roscpp transmission_interface urdf voltage_controllers +# CATKIN_DEPENDS angles control_toolbox gazebo hardware_interface joint_limits_interface pluginlib roscpp transmission_interface urdf electrical_interface # DEPENDS system_lib ) diff --git a/include/gazebo_ros_electrical/dcmotor_robot_hw_sim.h b/include/gazebo_ros_electrical/dcmotor_robot_hw_sim.h index 15a53e7..db38205 100644 --- a/include/gazebo_ros_electrical/dcmotor_robot_hw_sim.h +++ b/include/gazebo_ros_electrical/dcmotor_robot_hw_sim.h @@ -74,8 +74,8 @@ // URDF #include -//Fix this -#include +// Electrical inteface +#include namespace gazebo_ros_electrical @@ -119,7 +119,7 @@ protected: hardware_interface::EffortJointInterface ej_interface_; hardware_interface::PositionJointInterface pj_interface_; hardware_interface::VelocityJointInterface vj_interface_; - hardware_interface::VoltageJointInterface uj_interface_; + electrical_interface::VoltageJointInterface uj_interface_; joint_limits_interface::EffortJointSaturationInterface ej_sat_interface_; joint_limits_interface::EffortJointSoftLimitsInterface ej_limits_interface_; diff --git a/package.xml b/package.xml index c187572..c439623 100644 --- a/package.xml +++ b/package.xml @@ -51,7 +51,7 @@ roscpp transmission_interface urdf - voltage_controllers + electrical_interface angles control_toolbox gazebo @@ -62,7 +62,7 @@ roscpp transmission_interface urdf - voltage_controllers + electrical_interface diff --git a/src/dcmotor_robot_hw_sim.cpp b/src/dcmotor_robot_hw_sim.cpp index 0ff1caf..caa7b5c 100644 --- a/src/dcmotor_robot_hw_sim.cpp +++ b/src/dcmotor_robot_hw_sim.cpp @@ -286,14 +286,19 @@ void DCmotorRobotHWSim::readSim(ros::Time time, ros::Duration period) for(unsigned int j=0; j < n_dof_; j++) { // Gazebo has an interesting API... +#if GAZEBO_MAJOR_VERSION >= 8 + double position = sim_joints_[j]->Position(0); +#else + double position = sim_joints_[j]->GetAngle(0).Radian(); +#endif if (joint_types_[j] == urdf::Joint::PRISMATIC) { - joint_position_[j] = sim_joints_[j]->GetAngle(0).Radian(); + joint_position_[j] = position; } else { joint_position_[j] += angles::shortest_angular_distance(joint_position_[j], - sim_joints_[j]->GetAngle(0).Radian()); + position); } joint_velocity_[j] = sim_joints_[j]->GetVelocity(0); joint_effort_[j] = sim_joints_[j]->GetForce((unsigned int)(0)); @@ -438,7 +443,7 @@ void DCmotorRobotHWSim::registerJointLimits(const std::string& joint_name, if (urdf_model != NULL) { - const boost::shared_ptr urdf_joint = urdf_model->getJoint(joint_name); + const urdf::JointConstSharedPtr urdf_joint = urdf_model->getJoint(joint_name); if (urdf_joint != NULL) { *joint_type = urdf_joint->type;