Skip to content

Commit 9670317

Browse files
committed
Add TRAJ mode for gimbal.
1 parent cb20569 commit 9670317

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

rm_gimbal_controllers/include/rm_gimbal_controllers/gimbal_base.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ class Controller : public controller_interface::MultiInterfaceController<rm_cont
142142
void rate(const ros::Time& time, const ros::Duration& period);
143143
void track(const ros::Time& time);
144144
void direct(const ros::Time& time);
145+
void traj(const ros::Time& time);
145146
bool setDesIntoLimit(double& real_des, double current_des, double base2gimbal_current_des,
146147
const urdf::JointConstSharedPtr& joint_urdf);
147148
void moveJoint(const ros::Time& time, const ros::Duration& period);
@@ -199,7 +200,8 @@ class Controller : public controller_interface::MultiInterfaceController<rm_cont
199200
{
200201
RATE,
201202
TRACK,
202-
DIRECT
203+
DIRECT,
204+
TRAJ
203205
};
204206
int state_ = RATE;
205207
};

rm_gimbal_controllers/src/gimbal_base.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ void Controller::update(const ros::Time& time, const ros::Duration& period)
192192
case DIRECT:
193193
direct(time);
194194
break;
195+
case TRAJ:
196+
traj(time);
197+
break;
195198
}
196199
moveJoint(time, period);
197200
}
@@ -356,6 +359,16 @@ void Controller::direct(const ros::Time& time)
356359
setDes(time, yaw, pitch);
357360
}
358361

362+
void Controller::traj(const ros::Time& time)
363+
{
364+
if (state_changed_)
365+
{ // on enter
366+
state_changed_ = false;
367+
ROS_INFO("[Gimbal] Enter TRAJ");
368+
}
369+
setDes(time, cmd_gimbal_.yaw_des, cmd_gimbal_.pitch_des);
370+
}
371+
359372
bool Controller::setDesIntoLimit(double& real_des, double current_des, double base2gimbal_current_des,
360373
const urdf::JointConstSharedPtr& joint_urdf)
361374
{

0 commit comments

Comments
 (0)