Project

General

Profile

Revision a2b7e8f1

IDa2b7e8f1f46277c9bfd1dc026537b28be9bd5fc8

Added by Priya about 4 years ago

Registered a default callback for wireless receiver. Also added default virtual constructor.

View differences:

scout/libscout/src/Behavior.cpp
54 54
    name = my_name;
55 55
    sensors->init(&motors, &buttons, &sonar, &encoders, &linesensor,
56 56
                        &wl_sender, &wl_receiver);
57
    wl_receiver->register_callback(std::bind(&Behavior::default_callback,
58
        this, std::placeholders::_1));
59

  
57 60
    loop_rate = new ros::Rate(10);
58 61
}
59 62

  
60 63
/**
64
 * Cleans up after a behavior is killed.
65
 */
66
Behavior::~Behavior()
67
{
68
  motors->set_sides(0, 0, MOTOR_ABSOLUTE);
69
  delete wl_receiver;
70
  delete loop_rate;
71
}
72

  
73
/**
74
 * Empty callback used as default callback for wireless receiver.
75
 */
76
void Behavior::default_callback(vector<uint8_t> data)
77
{
78
  return;
79
}
80

  
81
/**
61 82
 * Allows the behavior to check ros::ok(), without being aware of ROS.
62 83
 */
63 84
bool Behavior::ok()

Also available in: Unified diff