forked from Archive/PX4-Autopilot
Roboclaw: Consistent Left & Right naming convertion with Differential Drive class
This commit is contained in:
parent
f53edfa440
commit
09d30568ab
|
@ -1,5 +1,5 @@
|
|||
uint64 timestamp # time since system start (microseconds)
|
||||
|
||||
# Two wheels: 0 left, 1 right
|
||||
# Two wheels: 0 right, 1 left
|
||||
float32[2] wheel_speed # [rad/s]
|
||||
float32[2] wheel_angle # [rad]
|
||||
|
|
|
@ -157,8 +157,8 @@ int Roboclaw::initializeUART()
|
|||
bool Roboclaw::updateOutputs(bool stop_motors, uint16_t outputs[MAX_ACTUATORS],
|
||||
unsigned num_outputs, unsigned num_control_groups_updated)
|
||||
{
|
||||
float left_motor_output = -((float)outputs[1] - 128.0f) / 127.f;
|
||||
float right_motor_output = ((float)outputs[0] - 128.0f) / 127.f;
|
||||
float left_motor_output = -((float)outputs[1] - 128.0f) / 127.f;
|
||||
|
||||
if (stop_motors) {
|
||||
setMotorSpeed(Motor::Left, 0.f);
|
||||
|
@ -234,10 +234,10 @@ int Roboclaw::readEncoder()
|
|||
int32_t position_right = swapBytesInt32(&buffer_positon[0]);
|
||||
|
||||
wheel_encoders_s wheel_encoders{};
|
||||
wheel_encoders.wheel_speed[0] = static_cast<float>(speed_left) / _param_rbclw_counts_rev.get() * M_TWOPI_F;
|
||||
wheel_encoders.wheel_speed[1] = static_cast<float>(speed_right) / _param_rbclw_counts_rev.get() * M_TWOPI_F;
|
||||
wheel_encoders.wheel_angle[0] = static_cast<float>(position_left) / _param_rbclw_counts_rev.get() * M_TWOPI_F;
|
||||
wheel_encoders.wheel_angle[1] = static_cast<float>(position_right) / _param_rbclw_counts_rev.get() * M_TWOPI_F;
|
||||
wheel_encoders.wheel_speed[0] = static_cast<float>(speed_right) / _param_rbclw_counts_rev.get() * M_TWOPI_F;
|
||||
wheel_encoders.wheel_speed[1] = static_cast<float>(speed_left) / _param_rbclw_counts_rev.get() * M_TWOPI_F;
|
||||
wheel_encoders.wheel_angle[0] = static_cast<float>(position_right) / _param_rbclw_counts_rev.get() * M_TWOPI_F;
|
||||
wheel_encoders.wheel_angle[1] = static_cast<float>(position_left) / _param_rbclw_counts_rev.get() * M_TWOPI_F;
|
||||
wheel_encoders.timestamp = hrt_absolute_time();
|
||||
_wheel_encoders_pub.publish(wheel_encoders);
|
||||
|
||||
|
|
|
@ -65,8 +65,8 @@ public:
|
|||
virtual ~Roboclaw();
|
||||
|
||||
enum class Motor {
|
||||
Left = 0,
|
||||
Right = 1
|
||||
Right = 0,
|
||||
Left = 1
|
||||
};
|
||||
|
||||
static int task_spawn(int argc, char *argv[]); ///< @see ModuleBase
|
||||
|
|
Loading…
Reference in New Issue