billmania / roboquest_core

The backend functionality for the RoboQuest project
1 stars 0 forks source link

Allow servos to be treated like motors #65

Closed billmania closed 10 months ago

billmania commented 11 months ago

Instead of only commanding servos to attain a specific angular position, provide a means to treat them like motors. This new capability will support commanding the servo to rotate in a specific direction at a specific RPM.

Required by rq_ui Issue 130, requires rq_msgs Issue 8, and described by Configuring and using servos

For future reference: ROS2 MoveIt! Servo

billmania commented 11 months ago

Instead of appending ServoAngle messages to a list attribute of the ServoAngles message, define a new message named Servos. Servos will have support for 16 servos, via the Servo message. Each servo will have an attribute for:

The Servos message will be suitable for use with Slider and Joystick widgets, including their configured keys.

billmania commented 11 months ago

Implement four methods in Servos:

  1. move the servos to a specific angle causes the servos to move. updates the current angle for each
  2. set the servo angle applies the joint min and max constraints, set the desired servo angle
  3. increment the servo angle retrieve the current angle and apply the increment. applies the joint min and max constraints, set the calculated servo angle
  4. set the servo speed retrieve the current angle. calculate the new angle based on the speed and MOVE_PERIOD. applies the joint min and max constraints, set the calculated servo angle

The move method will be executed by a thread in a loop waiting on the GO Event. A second thread will set the GO Event every MOVE_PERIOD. Each time there has been a change to the commands for the servos, the GO Event will be set.

Set some constants:

  1. MOVE_PERIOD - the rate at which the move method is called. Used in the calculation for the handle-a-speed method. Defines how frequently the servo motion can be updated.