Skip to content
Snippets Groups Projects
Commit 29e31bea authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Solved a problem with the detection of the rising edge of the start button. It...

Solved a problem with the detection of the rising edge of the start button. It was only etected the first time.
Changed the sign og the compass value to make it coincide with the real robot sensor.
parent a6fbf768
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -91,7 +91,7 @@ catkin_package( ...@@ -91,7 +91,7 @@ catkin_package(
########### ###########
SET(BIOLOID_FW_PATH ~/humanoids/cm510_controller_fw) SET(BIOLOID_FW_PATH ~/humanoids/cm510_controller_fw)
SET(ProjectPath ~/humanoids/cm510_controller_fw/examples) SET(ProjectPath ~/Desktop/new_fw/sensors)
## Specify additional locations of header files ## Specify additional locations of header files
## Your package locations should be listed before other locations ## Your package locations should be listed before other locations
...@@ -126,8 +126,8 @@ add_library(${PROJECT_NAME} src/bioloid_controller_cm510.cpp ...@@ -126,8 +126,8 @@ add_library(${PROJECT_NAME} src/bioloid_controller_cm510.cpp
${BIOLOID_FW_PATH}/communications/src/dynamixel.c ${BIOLOID_FW_PATH}/communications/src/dynamixel.c
${BIOLOID_FW_PATH}/communications/src/serial_console.c ${BIOLOID_FW_PATH}/communications/src/serial_console.c
# main application module # main application module
${ProjectPath}/movements/movements.c
${ProjectPath}/movements/mtn_library.c ${ProjectPath}/main.c
# AVR simulation modules # AVR simulation modules
src/sim/avr_delay.c src/sim/avr_delay.c
src/sim/avr_registers.c src/sim/avr_registers.c
......
...@@ -329,11 +329,7 @@ namespace bioloid_controller_cm510 ...@@ -329,11 +329,7 @@ namespace bioloid_controller_cm510
/* get the actual simulation angles */ /* get the actual simulation angles */
for(unsigned int i=0;i<this->joints_.size();++i) for(unsigned int i=0;i<this->joints_.size();++i)
{
real_angles[i]=joints_[i].getPosition(); real_angles[i]=joints_[i].getPosition();
std::cout << real_angles[i] << ",";
}
std::cout << std::endl;
pushbuttons_loop(); pushbuttons_loop();
adc_loop(); adc_loop();
exp_board_loop(); exp_board_loop();
...@@ -348,10 +344,8 @@ namespace bioloid_controller_cm510 ...@@ -348,10 +344,8 @@ namespace bioloid_controller_cm510
{ {
target_angles[i] = ((((manager_servos[i].current_value+balance_offsets[i]-manager_servos[i].center_value)*300.0/1023.0)*3.14159)/180.0); target_angles[i] = ((((manager_servos[i].current_value+balance_offsets[i]-manager_servos[i].center_value)*300.0/1023.0)*3.14159)/180.0);
const double command = this->pids_[i]->computeCommand(target_angles[i]-real_angles[i],period); const double command = this->pids_[i]->computeCommand(target_angles[i]-real_angles[i],period);
std::cout << target_angles[i] << ",";
this->joints_[i].setCommand(command); this->joints_[i].setCommand(command);
} }
std::cout << std::endl;
} }
template <class HardwareInterface> template <class HardwareInterface>
...@@ -379,7 +373,7 @@ namespace bioloid_controller_cm510 ...@@ -379,7 +373,7 @@ namespace bioloid_controller_cm510
adc_values[BALANCE_GYRO_Y_CHANNEL]=512; adc_values[BALANCE_GYRO_Y_CHANNEL]=512;
} }
// process the compass information from the expansion board // process the compass information from the expansion board
exp_compass_value=(tf::getYaw(msg->orientation)*180.0/3.14159)*10.0; exp_compass_value=-(tf::getYaw(msg->orientation)*180.0/3.14159)*10.0;
if(((int16_t)exp_compass_value)<0) if(((int16_t)exp_compass_value)<0)
exp_compass_value+=3600; exp_compass_value+=3600;
} }
...@@ -519,7 +513,7 @@ namespace bioloid_controller_cm510 ...@@ -519,7 +513,7 @@ namespace bioloid_controller_cm510
if(msg->data&BTN_START) if(msg->data&BTN_START)
PIND&=~BTN_START; PIND&=~BTN_START;
else else
PINE|=BTN_START; PIND|=BTN_START;
} }
template <class HardwareInterface> template <class HardwareInterface>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment