From: Xavier L. <Ba...@us...> - 2012-05-15 13:27:16
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via bc94b6c746f8ff33a7d448ed453ed0619713d639 (commit) from 9e5759cec52e0fc9ec2c9aeaed62ef57bfdf6163 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bc94b6c746f8ff33a7d448ed453ed0619713d639 Author: Xavier Lagorce <Xav...@cr...> Date: Tue May 15 15:26:35 2012 +0200 [Controller_Motor_STM32] Added can message to specify speed of a motor ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Propulsion_Drive/controller_motor_stm32/can_messages.h b/elec/boards/Controller_Motor_STM32/Firmwares/Propulsion_Drive/controller_motor_stm32/can_messages.h index 1226a2b..aa5c8b1 100644 --- a/elec/boards/Controller_Motor_STM32/Firmwares/Propulsion_Drive/controller_motor_stm32/can_messages.h +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Propulsion_Drive/controller_motor_stm32/can_messages.h @@ -32,6 +32,7 @@ #define CAN_MSG_CONTROLLER_MODE 205 // controller_mode_can_msg_t #define CAN_MSG_BEZIER_ADD 206 // bezier_can_msg_t #define CAN_MSG_BEZIER_LIMITS 207 // bezier_limits_can_msg_t +#define CAN_MSG_MOTOR_COMMAND 208 // motor_command_can_msg_t /* +-----------------------------------------------------------------+ | CAN messages data structures | @@ -115,6 +116,11 @@ typedef struct { uint8_t mode; } controller_mode_msg_t; +// Command the speed of a particular motor +typedef struct { + uint8_t motor_id; + int32_t speed; +} motor_command_msg_t; /* +-----------------------------------------------------------------+ | CAN messages unions for data representation | @@ -175,5 +181,9 @@ typedef union { uint32_t data32[2]; } controller_mode_can_msg_t; +typedef union { + motor_command_msg_t data; + uint32_t data32[2]; +} motor_command_can_msg_t; #endif /* __CAN_MESSAGES_H */ diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Propulsion_Drive/controller_motor_stm32/can_monitor.c b/elec/boards/Controller_Motor_STM32/Firmwares/Propulsion_Drive/controller_motor_stm32/can_monitor.c index f41d686..bae2706 100644 --- a/elec/boards/Controller_Motor_STM32/Firmwares/Propulsion_Drive/controller_motor_stm32/can_monitor.c +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Propulsion_Drive/controller_motor_stm32/can_monitor.c @@ -155,6 +155,7 @@ static void NORETURN canMonitorListen_process(void) { controller_mode_can_msg_t controller_mode_msg; bezier_can_msg_t bezier_msg; bezier_limits_can_msg_t bezier_limits_msg; + motor_command_can_msg_t motor_command_msg; // Initialize constant parameters of TX frame txm.dlc = 8; @@ -239,6 +240,12 @@ static void NORETURN canMonitorListen_process(void) { mode = ROBOT_MODE_NORMAL; } break; + case CAN_MSG_MOTOR_COMMAND: + motor_command_msg.data32[0] = frame.data32[0]; + motor_command_msg.data32[1] = frame.data32[1]; + motorSetSpeed(motor_command_msg.data.motor_id, + motor_command_msg.data.speed); + break; } } } diff --git a/elec/boards/Controller_Motor_STM32/Firmwares/Propulsion_Drive/controller_motor_stm32/main.c b/elec/boards/Controller_Motor_STM32/Firmwares/Propulsion_Drive/controller_motor_stm32/main.c index 0f69fc0..48846a3 100644 --- a/elec/boards/Controller_Motor_STM32/Firmwares/Propulsion_Drive/controller_motor_stm32/main.c +++ b/elec/boards/Controller_Motor_STM32/Firmwares/Propulsion_Drive/controller_motor_stm32/main.c @@ -96,9 +96,6 @@ static void init(void) LED4_OFF(); timer_delay(100); } - - // Start Beacon motor - //motorSetSpeed(MOTOR2, 1100); } static void NORETURN ind_process(void) hooks/post-receive -- krobot |