|
@@ -1,5 +1,10 @@
|
|
|
#include <control/control_status.h>
|
|
|
|
|
|
+
|
|
|
+#define GET_HIGH_BYTE(x) ((x >> 8) & 0xFF)
|
|
|
+#define GET_LOW_BYTE(x) (x & 0xFF)
|
|
|
+
|
|
|
+
|
|
|
void iv::control::ControlStatus::set_head()
|
|
|
{
|
|
|
command.bit.head = 0xEB;
|
|
@@ -8,20 +13,20 @@ void iv::control::ControlStatus::set_head()
|
|
|
void iv::control::ControlStatus::set_wheel_angle(float angle)
|
|
|
{
|
|
|
int ang = (int)(angle * 100);
|
|
|
- command.bit.ang_H = (ang) >> 8;
|
|
|
- command.bit.ang_L = (ang) % 256;
|
|
|
+ command.bit.ang_H = get_HIGH_BYTE(ang);
|
|
|
+ command.bit.ang_L = get_LOW_BYTE(ang);
|
|
|
}
|
|
|
|
|
|
void iv::control::ControlStatus::set_brake(bool enable)
|
|
|
{
|
|
|
- command.bit.brake=(unsigned)enable;
|
|
|
+ command.bit.brake=(unsigned char)enable;
|
|
|
}
|
|
|
|
|
|
void iv::control::ControlStatus::set_velocity(float vel)
|
|
|
{
|
|
|
int v = (int)(vel * 1000);
|
|
|
- command.bit.vel_H = v >> 8;
|
|
|
- command.bit.vel_L = v % 256;
|
|
|
+ command.bit.vel_H = get_HIGH_BYTE(v);
|
|
|
+ command.bit.vel_L = get_LOW_BYTE(v);
|
|
|
}
|
|
|
|
|
|
void iv::control::ControlStatus::set_left_light(bool enable)
|
|
@@ -42,7 +47,7 @@ void iv::control::ControlStatus::set_right_light(bool enable)
|
|
|
|
|
|
void iv::control::ControlStatus::set_highbeam(bool enable)
|
|
|
{
|
|
|
- command.bit.high_beam = (char)enable;
|
|
|
+ command.bit.high_beam = (unsigned char)enable;
|
|
|
}
|
|
|
|
|
|
void iv::control::ControlStatus::set_dangwei(int dangwei)
|