Skip to content

AGX Xavier + Megapi Project: megapi, uart, i2c, general robotics controls.

License

Notifications You must be signed in to change notification settings

kelceydamage/xavier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AGX Xavier + Megapi Project

AGX Xavier + Megapi Project: megapi, uart, i2c, general robotics controls.

Example

int main(int argc, char* argv[])
{
    try {
        MegapiDriver driver(config::terminal, config::baud_rate);
        Movement movement(&driver);
        Sensor ultrasonic_sensor(
            &driver, devices::ultrasonic_sensor, ports::sensor4
        );
        Sensor compass(
            &driver, devices::compass, ports::sensor3
        );

        movement.forward(255, 1);

        movement.stop(1);

        movement.reverse(255, 1);

        movement.stop(1);

        int n = 10;
        while (n > 0)
        {
            Debug::print_sensor_reading(ultrasonic_sensor.read());
            Debug::print_sensor_reading(compass.read());
            n--;
        }

        std::exit(0);

    } catch(boost::system::system_error& e)
    {
        std::cout << "Error: " << e.what() << std::endl;
        return 1;
    }
}

Configuration

namespace config
{
    int baud_rate = 115200;
    std::string terminal = "/dev/ttyTHS0";
}

About

AGX Xavier + Megapi Project: megapi, uart, i2c, general robotics controls.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published