Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation for angular position control, Cartesian position control and gripper position control #105

Merged

Conversation

alexvannobel
Copy link
Contributor

This includes implementation for

  • ReachJointAngles actions
  • ReachPose actions
  • GripperCommand actions
  • Stop, StopAction and ApplyEmergencyStop functions

The bulk of the implementation is in kortex_simulation.h/.cpp.
This heavily uses KDL for forward and inverse kinematics.

As for how this is done:

  • ReachJointAngles: The goal is transformed in radians and wrapped. A velocity profile for each joint is created given its max velocity or the wanted duration. If no constraint is given, the minimal duration is calculated. A trajectory is then created and sent to ROS Control for execution.

  • ReachPose: The starting frame is calculated (with FK) from the current joint angles. The ending frame is supplied in the Action. A Path_Line object is created for the path we want to follow, as well as a Trapezoidal Velocity profile for the length we have to go through and concatenated in a TrajectorySegment object. This object is used to fill a Joint Trajectory (with IK) that will be executed by the ROS Control Joint Trajectory Controller.

  • GripperCommand : The gripper command is simply transformed in absolute value (values ranging between the min and max values in the gripper's URDF) from relative value (between 0 and 1) given in the Action. It is then sent to the GripperCommand ROS Control controller for execution.

  • All the "Stop" functions : Those functions cancel all the goals on the Action Servers so the arm and gripper stop moving at once. The "Fault" state is not simulated although it would not be hard to add.

…h the kortex_driver too, in a different mode
…rm and correctly use velocity limits in constraints
… gripper joint is at the start of joint_states and sometimes it's at the end
@huiwenzhang
Copy link

@alexvannobel Hi, I am trying to control the robot with moveit. As it has been reported that the output trajectory from moveit can't be executed by the robot (as discussed here #66), so I am trying to calculated a joint trajectory, and then execute the trajectory with customized controller. This PR implements the reach joint angles action, it seems to fit my purpose very well. Meanwhile, the official repo provides a pre_cpmputed_joint_trajectory_action_server, which seems to solve the problem as well. What's the difference between these two implementations? I dived into the code, it seems the pre_cpmputed_joint_trajectory_action_server execute the trajectory by calling a low-level method called PlayPreComputedJointTrajectory with input data structure proto_trajectory defined in this repo. Your code execute the trajectory by using ros follow_join_trajectory_action controller with a standard JointTrajectory input (

kortex_driver::KortexError KortexArmSimulation::ExecuteReachJointAngles(const kortex_driver::Action& action)
). I am wandering whether the gen3 arm works in this way. After all, the moveit use the same follow joint trajectory controller as far as I know. Besides, I am also confused about how to compute a valid trajectory for gen3 arm? As the official documentation, the trajectory should be interploated by 1ms interval, your code use 0.01s interval as I am not wrong. In a word, as for my purpose, which way should I use?

@alexvannobel alexvannobel merged commit ed4b3b0 into feature/improve-simulation Jul 10, 2020
@alexvannobel alexvannobel deleted the feature/gripper-control-in-simulation branch July 10, 2020 16:12
alexvannobel added a commit that referenced this pull request Aug 5, 2020
* Separate generators for robot and simulation handlers (#99)

* Created interface class and put the RPC handlers in robot folder

* Now the robot functions interface work just like before

* Added templates and generation for simulated services

* Added the simulation services to the driver headers

* Added newly generated files to repo

* Adapt simulation launch files and add prefix support for simulation and MoveIt (#100)

* Created interface class and put the RPC handlers in robot folder

* Now the robot functions interface work just like before

* Added templates and generation for simulated services

* Added the simulation services to the driver headers

* Added newly generated files to repo

* Added simulation option to the driver so the gazebo package can launch the kortex_driver too, in a different mode

* Adapt joint_limits files to correctly take prefix option

* Change description and control files to support prefix option

* Change MoveIt config launch and config files to enable prefix option - only SRDF modifications remain

* Added xacro usage in SRDF files to be able to prefix joint names

* Adjust ompl planning launch and config files to support prefixing joint names

* Remove --inorder from xacro calls since it's default now

* Create simulation handlers (#102)

* Created interface class and put the RPC handlers in robot folder

* Now the robot functions interface work just like before

* Added templates and generation for simulated services

* Added the simulation services to the driver headers

* Added newly generated files to repo

* Added simulation option to the driver so the gazebo package can launch the kortex_driver too, in a different mode

* Adapt joint_limits files to correctly take prefix option

* Change description and control files to support prefix option

* Change MoveIt config launch and config files to enable prefix option - only SRDF modifications remain

* Added xacro usage in SRDF files to be able to prefix joint names

* Adjust ompl planning launch and config files to support prefixing joint names

* Remove --inorder from xacro calls since it's default now

* Set default gripper in launch files

* Add namespace to launch file parameters passed to driver

* Added class and implementation for simulator

* Add stubs and register handlers for Action API

* Add implementation for default actions and ReacAction/ReadAllActions

* Added some unit tests for simulator and CreateAction implentation

* Added the case where the prefix could be empty in XACRO

* Added prefix support for fake controllers in MoveIt configs

* Added a missing prefix value for Gen3 and fix the if and unless tags

* Add test launch file to launch simulator unit tests

* Don't create the gripper Move Group if no gripper on the arm

* Added DeleteAction implementation and tests

* Add implementation and tests for UpdateAction

* Added basic frame for a threaded action executor

* Added publishing for action topic before and after action execution

* Added StopAction logic and tests for executing and aborting actions

* Added stubs for other RPCs we want to support at first in simulation

* Added implementation for other RPCs worth simulating

* Added some data structure checks and TODOs in executors

* Added tests for newly added RPCs

* Remove merge artefacts

* Implementation for angular position control, Cartesian position control and gripper position control (#105)

* Created interface class and put the RPC handlers in robot folder

* Now the robot functions interface work just like before

* Added templates and generation for simulated services

* Added the simulation services to the driver headers

* Added newly generated files to repo

* Added simulation option to the driver so the gazebo package can launch the kortex_driver too, in a different mode

* Adapt joint_limits files to correctly take prefix option

* Change description and control files to support prefix option

* Change MoveIt config launch and config files to enable prefix option - only SRDF modifications remain

* Added xacro usage in SRDF files to be able to prefix joint names

* Adjust ompl planning launch and config files to support prefixing joint names

* Remove --inorder from xacro calls since it's default now

* Set default gripper in launch files

* Add namespace to launch file parameters passed to driver

* Added class and implementation for simulator

* Add stubs and register handlers for Action API

* Add implementation for default actions and ReacAction/ReadAllActions

* Added some unit tests for simulator and CreateAction implentation

* Added the case where the prefix could be empty in XACRO

* Added prefix support for fake controllers in MoveIt configs

* Added a missing prefix value for Gen3 and fix the if and unless tags

* Add test launch file to launch simulator unit tests

* Don't create the gripper Move Group if no gripper on the arm

* Added DeleteAction implementation and tests

* Add implementation and tests for UpdateAction

* Added basic frame for a threaded action executor

* Added publishing for action topic before and after action execution

* Added StopAction logic and tests for executing and aborting actions

* Added stubs for other RPCs we want to support at first in simulation

* Added implementation for other RPCs worth simulating

* Added some data structure checks and TODOs in executors

* Added tests for newly added RPCs

* Remove merge artefacts

* Added implementation for ReachJointAngles action - optimal duration implementation remain

* Added KDL parsing and solvers construction

* Add max velocities and max accelerations to joint_limits.yaml files

* Add a helper to fill KortexError and finish velocity profiles implementation for ReachJointAngles

* Now use the velocity profile data to fill the trajectory

* Add implementation for angular position control

* Add same ROS parameters than real arm and adjust first timestamp to not be 0

* Fix MoveIt config Gen3 lite home position

* Added ReachPose implementation, twist limits still hardcoded

* Add twist limits files for simulation

* Use the correct Cartesian velocity and acceleration values for each arm and correctly use velocity limits in constraints

* Add simulated feedback support and change current state to fetch joint_states instead of controller state

* Added implementation for gripper control

* Fixed a Robotiq 2F-140 typo in the moveit config

* Added indexes for first arm joint and gripper joint because sometimes gripper joint is at the start of joint_states and sometimes it's at the end

* Address PR comments

* Fix tool frame for 6DOF Gen3 arm

* Simulation velocity control, documentation and examples update (#109)

* Created interface class and put the RPC handlers in robot folder

* Now the robot functions interface work just like before

* Added templates and generation for simulated services

* Added the simulation services to the driver headers

* Added newly generated files to repo

* Added simulation option to the driver so the gazebo package can launch the kortex_driver too, in a different mode

* Adapt joint_limits files to correctly take prefix option

* Change description and control files to support prefix option

* Change MoveIt config launch and config files to enable prefix option - only SRDF modifications remain

* Added xacro usage in SRDF files to be able to prefix joint names

* Adjust ompl planning launch and config files to support prefixing joint names

* Remove --inorder from xacro calls since it's default now

* Set default gripper in launch files

* Add namespace to launch file parameters passed to driver

* Added class and implementation for simulator

* Add stubs and register handlers for Action API

* Add implementation for default actions and ReacAction/ReadAllActions

* Added some unit tests for simulator and CreateAction implentation

* Added the case where the prefix could be empty in XACRO

* Added prefix support for fake controllers in MoveIt configs

* Added a missing prefix value for Gen3 and fix the if and unless tags

* Add test launch file to launch simulator unit tests

* Don't create the gripper Move Group if no gripper on the arm

* Added DeleteAction implementation and tests

* Add implementation and tests for UpdateAction

* Added basic frame for a threaded action executor

* Added publishing for action topic before and after action execution

* Added StopAction logic and tests for executing and aborting actions

* Added stubs for other RPCs we want to support at first in simulation

* Added implementation for other RPCs worth simulating

* Added some data structure checks and TODOs in executors

* Added tests for newly added RPCs

* Remove merge artefacts

* Added implementation for ReachJointAngles action - optimal duration implementation remain

* Added KDL parsing and solvers construction

* Add max velocities and max accelerations to joint_limits.yaml files

* Add a helper to fill KortexError and finish velocity profiles implementation for ReachJointAngles

* Now use the velocity profile data to fill the trajectory

* Add implementation for angular position control

* Add same ROS parameters than real arm and adjust first timestamp to not be 0

* Fix MoveIt config Gen3 lite home position

* Added ReachPose implementation, twist limits still hardcoded

* Add twist limits files for simulation

* Use the correct Cartesian velocity and acceleration values for each arm and correctly use velocity limits in constraints

* Add simulated feedback support and change current state to fetch joint_states instead of controller state

* Added implementation for gripper control

* Fixed a Robotiq 2F-140 typo in the moveit config

* Added indexes for first arm joint and gripper joint because sometimes gripper joint is at the start of joint_states and sometimes it's at the end

* Changed the way the individual position controllers are loaded and started as well as added service client in simulator to switch controllers based on RPC called

* Added implementation for angular velocity control and added joint limits to simulation class. Will need a way to wrap-around angles now that velocity control for infinite spinning joint is on.

* Added wrapping around in reach joint angles

* Fix a problem with timestamps

* Added an implementation for SendTwistCommand but not stable enough to be activated so handler is commented out

* Dont start the joint_7 controller for a 6DOF robot

* Changed the examples to use notifications to check whether an action is finished or not and removed the sleeps

* Put back the homing script for Gazebo and removed the copyright notice since we don't use MoveIt anymore to home the arm

* Adapt documentation for new simulation features

* Updated the package.xml's with bumped versions and author and maintainer tags

* Few minor tweaks in the examples

* Added a bit of details in the documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants