-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added joint velocity and cartesian velocity robot control.
Showing
18 changed files
with
546 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
franka-interface/include/franka-interface/skills/cartesian_velocity_skill.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef FRANKA_INTERFACE_SKILLS_CARTESIAN_VELOCITY_SKILL_H_ | ||
#define FRANKA_INTERFACE_SKILLS_CARTESIAN_VELOCITY_SKILL_H_ | ||
|
||
#include "franka-interface/skills/base_skill.h" | ||
|
||
class CartesianVelocitySkill : public BaseSkill { | ||
public: | ||
CartesianVelocitySkill(int skill_idx, int meta_skill_idx, std::string description) : | ||
BaseSkill(skill_idx, meta_skill_idx, description) | ||
{}; | ||
|
||
void execute_skill_on_franka(run_loop* run_loop, | ||
FrankaRobot* robot, | ||
FrankaGripper* gripper, | ||
RobotStateData* robot_state_data) override; | ||
|
||
private: | ||
bool return_status_{false}; | ||
}; | ||
|
||
#endif // FRANKA_INTERFACE_SKILLS_CARTESIAN_VELOCITY_SKILL_H_ |
21 changes: 21 additions & 0 deletions
21
franka-interface/include/franka-interface/skills/joint_velocity_skill.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef FRANKA_INTERFACE_SKILLS_JOINT_VELOCITY_SKILL_H_ | ||
#define FRANKA_INTERFACE_SKILLS_JOINT_VELOCITY_SKILL_H_ | ||
|
||
#include "franka-interface/skills/base_skill.h" | ||
|
||
class JointVelocitySkill : public BaseSkill { | ||
public: | ||
JointVelocitySkill(int skill_idx, int meta_skill_idx, std::string description) : | ||
BaseSkill(skill_idx, meta_skill_idx, description) | ||
{}; | ||
|
||
void execute_skill_on_franka(run_loop* run_loop, | ||
FrankaRobot* robot, | ||
FrankaGripper* gripper, | ||
RobotStateData* robot_state_data) override; | ||
|
||
private: | ||
bool return_status_{false}; | ||
}; | ||
|
||
#endif // FRANKA_INTERFACE_SKILLS_JOINT_VELOCITY_SKILL_H_ |
36 changes: 36 additions & 0 deletions
36
...e/include/franka-interface/trajectory_generator/cartesian_velocity_trajectory_generator.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#ifndef FRANKA_INTERFACE_TRAJECTORY_GENERATOR_CARTESIAN_VELOCITY_TRAJECTORY_GENERATOR_H_ | ||
#define FRANKA_INTERFACE_TRAJECTORY_GENERATOR_CARTESIAN_VELOCITY_TRAJECTORY_GENERATOR_H_ | ||
|
||
#include <array> | ||
|
||
#include "franka-interface/trajectory_generator/trajectory_generator.h" | ||
|
||
class CartesianVelocityTrajectoryGenerator : public TrajectoryGenerator { | ||
public: | ||
using TrajectoryGenerator::TrajectoryGenerator; | ||
|
||
void parse_parameters() override; | ||
|
||
void initialize_trajectory(const franka::RobotState &robot_state, SkillType skill_type=SkillType::CartesianVelocitySkill) override; | ||
|
||
/** | ||
* Initialize initial and desired Cartesian velocities from robot state | ||
*/ | ||
void initialize_initial_cartesian_velocities(const franka::RobotState &robot_state, SkillType skill_type); | ||
|
||
/** | ||
* Returns the desired Cartesian velocities. This method is called at every time step of the control loop to | ||
* find the Cartesian velocities to send at the next step. | ||
*/ | ||
const std::array<double, 6>& get_desired_cartesian_velocities() const; | ||
|
||
protected: | ||
CartesianVelocityTrajectoryGeneratorMessage cartesian_velocity_trajectory_params_; | ||
|
||
std::array<double, 6> initial_cartesian_velocities_{}; | ||
std::array<double, 6> cartesian_accelerations_{}; | ||
std::array<double, 6> desired_cartesian_velocities_{}; | ||
std::array<double, 6> goal_cartesian_velocities_{}; | ||
}; | ||
|
||
#endif // FRANKA_INTERFACE_TRAJECTORY_GENERATOR_CARTESIAN_VELOCITY_TRAJECTORY_GENERATOR_H_ |
36 changes: 36 additions & 0 deletions
36
...rface/include/franka-interface/trajectory_generator/joint_velocity_trajectory_generator.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#ifndef FRANKA_INTERFACE_TRAJECTORY_GENERATOR_JOINT_VELOCITY_TRAJECTORY_GENERATOR_H_ | ||
#define FRANKA_INTERFACE_TRAJECTORY_GENERATOR_JOINT_VELOCITY_TRAJECTORY_GENERATOR_H_ | ||
|
||
#include <array> | ||
|
||
#include "franka-interface/trajectory_generator/trajectory_generator.h" | ||
|
||
class JointVelocityTrajectoryGenerator : public TrajectoryGenerator { | ||
public: | ||
using TrajectoryGenerator::TrajectoryGenerator; | ||
|
||
void parse_parameters() override; | ||
|
||
void initialize_trajectory(const franka::RobotState &robot_state, SkillType skill_type=SkillType::JointVelocitySkill) override; | ||
|
||
/** | ||
* Initialize initial and desired joint velocities from robot state | ||
*/ | ||
void initialize_initial_joint_velocities(const franka::RobotState &robot_state, SkillType skill_type); | ||
|
||
/** | ||
* Returns the desired joint velocities. This method is called at every time step of the control loop to | ||
* find the joint velocities to send at the next step. | ||
*/ | ||
const std::array<double, 7>& get_desired_joint_velocities() const; | ||
|
||
protected: | ||
JointVelocityTrajectoryGeneratorMessage joint_velocity_trajectory_params_; | ||
|
||
std::array<double, 7> initial_joint_velocities_{}; | ||
std::array<double, 7> joint_accelerations_{}; | ||
std::array<double, 7> desired_joint_velocities_{}; | ||
std::array<double, 7> goal_joint_velocities_{}; | ||
}; | ||
|
||
#endif // FRANKA_INTERFACE_TRAJECTORY_GENERATOR_JOINT_VELOCITY_TRAJECTORY_GENERATOR_H_ |
19 changes: 19 additions & 0 deletions
19
...nka-interface/trajectory_generator/pass_through_cartesian_velocity_trajectory_generator.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef FRANKA_INTERFACE_TRAJECTORY_GENERATOR_PASS_THROUGH_CARTESIAN_VELOCITY_TRAJECTORY_GENERATOR_H_ | ||
#define FRANKA_INTERFACE_TRAJECTORY_GENERATOR_PASS_THROUGH_CARTESIAN_VELOCITY_TRAJECTORY_GENERATOR_H_ | ||
|
||
#include "franka-interface/trajectory_generator/cartesian_velocity_trajectory_generator.h" | ||
|
||
class PassThroughCartesianVelocityTrajectoryGenerator : public CartesianVelocityTrajectoryGenerator { | ||
public: | ||
using CartesianVelocityTrajectoryGenerator::CartesianVelocityTrajectoryGenerator; | ||
|
||
void get_next_step(const franka::RobotState &robot_state) {}; | ||
|
||
void parse_sensor_data(const franka::RobotState &robot_state) override; | ||
|
||
private: | ||
CartesianVelocitySensorMessage cartesian_velocity_sensor_msg_; | ||
|
||
}; | ||
|
||
#endif // FRANKA_INTERFACE_TRAJECTORY_GENERATOR_PASS_THROUGH_CARTESIAN_VELOCITY_TRAJECTORY_GENERATOR_H_ |
19 changes: 19 additions & 0 deletions
19
.../franka-interface/trajectory_generator/pass_through_joint_velocity_trajectory_generator.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef FRANKA_INTERFACE_TRAJECTORY_GENERATOR_PASS_THROUGH_JOINT_VELOCITY_TRAJECTORY_GENERATOR_H_ | ||
#define FRANKA_INTERFACE_TRAJECTORY_GENERATOR_PASS_THROUGH_JOINT_VELOCITY_TRAJECTORY_GENERATOR_H_ | ||
|
||
#include "franka-interface/trajectory_generator/joint_velocity_trajectory_generator.h" | ||
|
||
class PassThroughJointVelocityTrajectoryGenerator : public JointVelocityTrajectoryGenerator { | ||
public: | ||
using JointVelocityTrajectoryGenerator::JointVelocityTrajectoryGenerator; | ||
|
||
void get_next_step(const franka::RobotState &robot_state) {}; | ||
|
||
void parse_sensor_data(const franka::RobotState &robot_state) override; | ||
|
||
private: | ||
JointVelocitySensorMessage joint_velocity_sensor_msg_; | ||
|
||
}; | ||
|
||
#endif // FRANKA_INTERFACE_TRAJECTORY_GENERATOR_PASS_THROUGH_JOINT_VELOCITY_TRAJECTORY_GENERATOR_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.